Re: [PHP] exasperated again
Stuart wrote: 2009/7/4 PJ af.gour...@videotron.ca: Stuart wrote: 2009/7/4 PJ af.gour...@videotron.ca: Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart But not on a productions server, right? (Since this should have been corrected before going live) Indeed. If you're using the same server for both then use ini_set to turn display_errors off on the production site. -Stuart Or, if it is running apache, you can set these values from within the httpd.conf file for your respective VirtualHost.../VirtualHost -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, which can sometimes fail if there are fatal errors in the code. Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); which can sometimes fail if there are fatal errors in the code. Thanks Ash www.ashleysheridan.co.uk -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
2009/7/4 PJ af.gour...@videotron.ca: Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart -- http://stut.net/ which can sometimes fail if there are fatal errors in the code. Thanks Ash www.ashleysheridan.co.uk -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Stuart wrote: 2009/7/4 PJ af.gour...@videotron.ca: Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart Talk about exasperation: I just tried to find www.mangequebec.com on Guggle (!) Somebody tell me why on another computer going through the same connection to the internet finds and goes to that site. I have no reason to block that site as I never knew it existed. Yet, no matter how I input the name mange quebec, mangeQuebec, with or without the wwwcom or even .ca on FF3 and same results on IE8 this really sucks... -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Stuart wrote: 2009/7/4 PJ af.gour...@videotron.ca: Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart But not on a productions server, right? (Since this should have been corrected before going live) -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
2009/7/4 PJ af.gour...@videotron.ca: Stuart wrote: 2009/7/4 PJ af.gour...@videotron.ca: Ashley Sheridan wrote: On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: Jim Lucas wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, What do you mean from within PHP ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart But not on a productions server, right? (Since this should have been corrected before going live) Indeed. If you're using the same server for both then use ini_set to turn display_errors off on the production site. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
2009/7/1 PJ af.gour...@videotron.ca: Jay Blanchard wrote: [snip] Use the OOP interface to mysqli or PDO and these problems don't happen [/snip] Either that or include a modicum of error checking in your code. OK, Ok, I feel stupid enough already. I'm not sure I want to get in that deep... it's tough enough with the simple stuff... so, talk to me about the OOP interface or the PDO... :-\ The first step on the road to enlightenment is to learn how to learn without asking for help. 1) RTFM 2) Try it - set up a sandbox where you can play with code and make mistakes without consequences 3) Google/Bing it (yeah, Bing's never gonna catch on like that!) 4) Try it again 5) If you're still having problems ask here and include evidence that you've put some effort into steps 1-4 This list should be your last port of call when you can't figure something out. Now I have to disagree that the OO variants of the MySQL API are any better than the plain old mysql_* functions. In particular I have found PDO to be significantly slower. Yes you have to take care of escaping values in SQL statements yourself, but having to be consciously aware of security issues is never a bad thing unless you're lazy about it. As Jay says you cannot assume that any code that calls external services is going to work. You need to check return values, catch exceptions and do everything else you can to handle unexpected events. I've found that 99.99% of the time MySQL is perfectly reliable, but in the 0.01% you may unexpectedly lose the connection for any number of reasons. If you don't handle it then you could end up losing data but happily telling your users it was stored successfully. In general this is known as defensive programming. Never assume anything, handle every eventuality you can think of including the this will never happen cases, and always make sure you have a catch-all for stuff you can't think of. Learn to do this early and you'll have a much better time of it. Now I have to go and find June - I'm sure I lost a few days in there somewhere. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
Stuart wrote: 3) Google/Bing it (yeah, Bing's never gonna catch on like that!) Of cause it would be nice to see the Bing clockwork toys that run it ... I couldn't help giggle when they announced they were naming it after a toy manuafacturer :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
Lester Caine wrote: Stuart wrote: 3) Google/Bing it (yeah, Bing's never gonna catch on like that!) Of cause it would be nice to see the Bing clockwork toys that run it ... I couldn't help giggle when they announced they were naming it after a toy manuafacturer :) OT, but the first time I tried bing I resolved to not go back. If I search on spidean, which is the name of my site and is a Gaelic word found in the name of many mountain peaks in Scotland, I get results for spiderman as top results. In contrast, google asks me did you mean spiderman? but gives me all results for spidean. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and you will see the errors of your ways... -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
2009/6/30 PJ af.gour...@videotron.ca: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Is that exactly your code? see your 4th line: $result = msql_query($sql, $db); you forgot the y in mysql_query function... if you have a 500 error code maybe this is the problem -- Maximiliano Churichi mchuri...@gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? Damn, it's frustrating to find that there is a difference between msql and mysql... ouch, the foot hurts now! -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
On Tue, Jun 30, 2009 at 4:01 PM, PJaf.gour...@videotron.ca wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I see a typo in the last block where you call $result = msql_query(...) instead of $result = mysql_query(...). Is that in your actual code? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
On Tue, Jun 30, 2009 at 4:48 PM, PJaf.gour...@videotron.ca wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? Damn, it's frustrating to find that there is a difference between msql and mysql... ouch, the foot hurts now! -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Blame the native, libraries that is -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
On Tue, Jun 30, 2009 at 4:50 PM, Bastien Koertphps...@gmail.com wrote: On Tue, Jun 30, 2009 at 4:48 PM, PJaf.gour...@videotron.ca wrote: PJ wrote: Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = SELECT id FROM publishers WHERE publisher = 'whoever'; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo hello; works. This works in the test page: $aid = array(); $ord = array(); $sql = SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo br /; var_dump($ord); echo $aid[0], - ; echo $ord[0]; This does not: $fi=joe; $la=joe; $sql = SELECT id FROM author WHERE first_name = '$fi' last_name = '$la'; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) 0) { $a_id=$row['id']; } echo $a_id, br /br /; The test page prints out echo some text; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) IE 8. What is not fine? Damn, it's frustrating to find that there is a difference between msql and mysql... ouch, the foot hurts now! -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Blame the native, libraries that is -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Take it as a sign you shouldn't be using mysql_ at all :) Use the OOP interface to mysqli or PDO and these problems don't happen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] exasperated again - shot in the foot
[snip] Use the OOP interface to mysqli or PDO and these problems don't happen [/snip] Either that or include a modicum of error checking in your code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again - shot in the foot
Jay Blanchard wrote: [snip] Use the OOP interface to mysqli or PDO and these problems don't happen [/snip] Either that or include a modicum of error checking in your code. OK, Ok, I feel stupid enough already. I'm not sure I want to get in that deep... it's tough enough with the simple stuff... so, talk to me about the OOP interface or the PDO... :-\ -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php