Jump to content

mickeymouse

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by mickeymouse

  1. Very well but 1) How do I test the COUNT? 2) I tried $MyRowCount=mysql_num_rows(); (according to SQL Documentation) and I get 0 rows read, yet the DB has some 1000 rows. 3) Ignoring the counting aspect, I list the rows read with following code but there are no rows. So the real question besides the counting is "Why is it not reading the rows?" while ($row = mysql_fetch_row($Results)) print("...….. Tks
  2. Thank you dsonesuk. It works perfectly (all the time when we do it right) I'd like to give you points but don't know how. Can't see anything on the page that would allow me.
  3. I'm getting 0 in $AffectedRows and get my resulting message "There are no transactions..." Yet, I have many records in my "transactions" DB file. I Can't understand, can't see any errors in my code. I don't get any DB errors nor any other errors. The same code (for other DB files) works fine. $link = mysql_connect($host, $username, $password); if (!$link){die('Not connected : ' . mysql_error());} $db_selected = mysql_select_db($database, $link); if (!$db_selected){die ('Can\'t use ' .$database .':'. mysql_error());} $query = "SELECT * FROM `transactions` "; $Results = mysql_query($query, $link) or die ('Error = '. mysql_error()); $AffectedRows = mysql_affected_rows($link); if($AffectedRows < 1) {print("There are no transactions ……..
  4. I understand that to pass a paramater from one page to another from a call in a function I must have "?param=myparam" following my page id. e.g. function ancesterF(myparam) {location.href='mypage1.php? param=myparam';return false; window.open(location.href); return false;} and to pick-up the paramater in the called page, I need to use: $getmyparam=$_GET['param']; However, it doesn't work. The resulting pick-up is "myparam" instead of the value of "myparam" which is "10006" Does anyone know how to pick-up the value passed? I can't find anything about this in PHP documentation. Many thanks
  5. I tried that but I end up with the value of my $getmyparam being equal to "myparam" instead of the value passed which in my test case is "10006" In my calling function, I confirm the value of "myparam" and it is "10006". CALLING CODE: function ancesterF(myparam) {alert(myparam); <----------------------------------------------------------------------------------This confirms the value "10006" location.href='FT_Search2.php?param=myparam';return false; window.open(location.href); return false;} RECIEVING CODE: $getmyparam =$_GET['param']; print("getmyparam"); <------------------------------- Result = "myparam" not "10006"
  6. Thank you dsonesuk. I should also have asked you how do I capture the param in my called page.
  7. How do I pass a parameter (myparam) to the page I'm calling via a function. function ancesterF(myparam) {location.href=\"FT_Search2.php\";return false; window.open(location.href); return false;} Tks
  8. I'm Baffled. My code (as far as I can see) matches W3 School tutorial example but it doesn't work. My button to go to the function doesn't react (it does if I remove my red text code. "function myDelDB() {var r = Confirm('Delete'); if (r==true) {location.href='CAS_RoulDeleteDB.php'; return false; window.open(location.href); return false;} else{return false;} }"
  9. Wherever I'm using $link is because documentation told me to use it and I always used that and it always worked. As for my problem, it is resolved. My logic was totally wrong. This is the way it should have been: while($Rows = mysql_fetch_row($Results)) {print("Number = $Rows[0],<br>");} My original code covered my (erroneous) thinking that $Rows were Records in the Database instead of $rows being the fields in the records. So sorry to have taken your time. Many thanks
  10. I agree, $row = mysql_fetch_row ($Results) should be before the While loop so I've made the correction but it doesn't make any difference - I still have the unbelievable problem.
  11. The only way I know how to check what is in $Results is by printing it with a While loop but it doesn't work. I figure $Results has to contain the correct info since $AffectedRows = 4. My code to get $Results is: $link = mysql_connect($host, $username, $password); if (!$link){die('Not connected : ' . mysql_error());} $db_selected = mysql_select_db($database, $link); if (!$db_selected){die ('Can\'t use ' .$database .':'. mysql_error());} $query = "SELECT * FROM `spindat` WHERE `hand` <> 'x' "; $Results = mysql_query($query, $link) or die ('Error = '. mysql_error()); $AffectedRows = mysql_affected_rows($link);
  12. My $AffectedRows = 4 which matches my database rows but when I print via the following code only row 0 gets printed - screen output below. $cntr=0; while($AffectedRows > $cntr) {$row = mysql_fetch_row($Results); print("Number = $row[$cntr]<br>"); $cntr++;}
  13. I don't know why I am getting "011" instead of "2" after 2 times through my function. My code is: <input name=\"ent2a\" type='number' id=\"ent2a\" size=\"1\" style=\"text-align:center\" MaxLength=2 value=0 onblur=\"chkent(ent2a)\"> <input id='cntR' type='number' size='1' MaxLength=2 value=0> function chkent(entry) {with (entry); var e = entry.value; if(e==1){cntR.value = cntR.value + 1;return false;} return false;}
  14. Isn't this code correct? I'm trying to test for the length of an input field when submit is clicked. function formcheck() {if(stdcd.value.length < 9){alert(\"MUST BE 9 CHARACTERS.\");return false;} return true;} Thanks
  15. Isn't this code correct? I'm trying to test for the length of an input field when submit is clicked. function formcheck() {if(stdcd.value.length < 9){alert(\"MUST BE 9 CHARACTERS.\");return false;} return true;} Thanks
  16. {print("<option value=$row[1]>$row[1]</option>");} My $row[1] contains multiple words but only the first word is posted to the next file. Am I not allowed to have multiple word entries? Thank you
  17. How do we define the width for a Dropdown Box? My code is: print("<select name='title'> <option style='color:maroon; font-size:bold' name='title'>$title</option>"); while ($row = mysql_fetch_row($Results)) {print("<option value=$row[1]>$row[1]</option>");} print("</select>");. All of this works fine except I don't know where to define the width and can't find it in the W3S HRML documentation. Thank you
  18. It works perfectly on my other forms so it's not a browser related problem. I'll look at the link you gave me in more detail later but right now I would prefer to find the problem and fix it rather than venture into new stuff at this time. As I said, it works in my other forms so I don't see why it shouldn't work in this one. Thanks for your help and thanks for moving the item to Javascript - I keep thinking these functions I've coded are PHP - sorry about that.
  19. 1) Shouldn't the traditional way still work. 2) Don't know how to do the modern way.
  20. Shouldn't this code return me to my from and not take action to open the next program/file. function formcheck(myform) {alert('Form Check.'); return false;} with the following form parameters: <form name='AmendForm' action='FT_AmendUpdate.php' method='POST' onsubmit='return formcheck(AmendForm)'> Whether I use return true or return false, the submit displays the "Form Check" message and then opens the next program/file: FT_AmendUpdate.php
  21. OK. It looks like I'm using the wrong tag to get my box and write-up in the box. It seems I should be using Table tag which I've now tried. However, the width or max-width is not working. I show 50% but the box takes up the width of me widest line of text.
  22. My css definition is: p.six {width: 50%; height: 250px; margin-top: 30px; margin-left: auto; margin-right: auto; margin-bottom: 0px; border-style: solid; border width: 2px; border-color: blue; align: center; text-align: center; padding: 30px; background-color:white} Whatever I do with the "height" specification or even remove it completely, the height of my box remains the same at the original 250px. Actually, just noticed that a few other things don't work - like the width and background-color. I change these and nothing happens; it retains the original specs.
  23. The POST is done upon Submit because, in the called program, I print "filenm" and the path & name are there and correct. However, In the upload program, my first statement is '$target_dir = "C:/uploads/"; ' but the file doesn't get uploaded in this, I presume, temporary directory. Enough for tonight. Happy New Year and talk to you next year. Thanks
  24. So what you are telling me is that 'fileToUpload' should be 'filenm' (which is the name attribute I used in the request to upload). I have tried that. I've tried it pure, I've tried it with single quotes, I've tried it with double quotes and I always get the same error message.
  25. My code in request to upload is <input type='file' name='filenm' size='80'> My code in the upload program is $filenm=$_POST['filenm']; and this does give me the correct path & file name in my upload program. However I have no idea what is this "fileToUpload" in the W3S statement $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); and this "fileToUpload" is what is giving the error. If I replace "fileToUpload" with "$filenm" , i.e., $target_file = $target_dir . basename($_FILES["$filenm"]["name"]); I get error: Notice: Undefined index: C:\Users\Michael\Downloads\Pinocchio.jpg in C:\xampp\htdocs\Family Tree\FT_UploadFile.php on line 35
×
×
  • Create New...