Re: [PHP] supplied argument errors
PJ wrote: Lex Braun wrote: On Tue, Jun 23, 2009 at 4:10 PM, PJ af.gour...@videotron.ca mailto:af.gour...@videotron.ca wrote: I think there is something I do not understand in the manual about mysql_fetch_assoc(), mysql_affected_rows() The code works, but I get these annoying messages. snippet: snip What are the warnings? 1 .supplied argument is not a valid MySQL result resource 2. supplied argument is not a valid MySQL-link resource snippet: $result = mysql_query($sql, $db); // this is following an UPDATE $row = mysql_fetch_assoc($result); // warning... 1. if (mysql_affected_rows($result) !== -1) //warning...2. print_r($result); // returns 1 another: $sql = DELETE FROM book_categories WHERE bookID = $bid; $result = mysql_query($sql, $db); // warning...1. $row = mysql_fetch_assoc($result); // warning...1. if (mysql_num_rows($result) !== 0) { the last: $result = mysql_query($sql,$db); // following an INSERT if (mysql_affected_rows($result) == -1) { // warning2. Oh for $deity's sake, haven't you yet learned to a) echo your query and b) use mysql_error() as aids to debugging errors with mysql ??? Cheers -- David Robley Imagery is All In The Mind. Today is Setting Orange, the 29th day of Confusion in the YOLD 3175. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] supplied argument errors
Lex Braun wrote: On Tue, Jun 23, 2009 at 4:10 PM, PJ af.gour...@videotron.ca mailto:af.gour...@videotron.ca wrote: I think there is something I do not understand in the manual about mysql_fetch_assoc(), mysql_affected_rows() The code works, but I get these annoying messages. snippet: snip What are the warnings? 1 .supplied argument is not a valid MySQL result resource 2. supplied argument is not a valid MySQL-link resource snippet: $result = mysql_query($sql, $db); // this is following an UPDATE $row = mysql_fetch_assoc($result); // warning... 1. if (mysql_affected_rows($result) !== -1) //warning...2. print_r($result); // returns 1 another: $sql = DELETE FROM book_categories WHERE bookID = $bid; $result = mysql_query($sql, $db); // warning...1. $row = mysql_fetch_assoc($result); // warning...1. if (mysql_num_rows($result) !== 0) { the last: $result = mysql_query($sql,$db); // following an INSERT if (mysql_affected_rows($result) == -1) { // warning2. -- 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] supplied argument errors
On Tue, Jun 23, 2009 at 4:10 PM, PJ af.gour...@videotron.ca wrote: I think there is something I do not understand in the manual about mysql_fetch_assoc(), mysql_affected_rows() The code works, but I get these annoying messages. snippet: snip What are the warnings?
Re: [PHP] supplied argument errors
the code works? the above warnings suggest that ter is a mysql syntax error. moreover the documentation of mysql_affected_rows suggests that u should supply a valid recource identifier but not a mysql result resource. i.e., the above should be mysql_affected_rows($db)
Re: [PHP] supplied argument errors
kranthi wrote: the code works? the above warnings suggest that ter is a mysql syntax error. moreover the documentation of mysql_affected_rows suggests that u should supply a valid recource identifier but not a mysql result resource. i.e., the above should be mysql_affected_rows($db) Yes, so: 1. It was an UPDATE and not a SELECT, how would it return any f'ing rows?!?! $rows is either TRUE or FALSE, because it returns whether the UPDATE was successful or not. 2. Please read the f'ing manual about what kranthi said! -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php