haighster Posted August 3, 2010 Share Posted August 3, 2010 some please help - basically have a simple password change php page $sql="UPDATE t_members SET Password = '$New_Password' WHERE Username = '$My_Username' AND Password = '$Old_Password'"; echo $sql; $result=mysql_query($sql) or die(mysql_error()); $firstcount = mysql_num_rows($result); and i get this annoying error Warning: mysql_num_rows(): supplied argument is not a valid the sql statement works as i see it updating the database correctly Quote Link to comment https://forums.phpfreaks.com/topic/209650-help-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
Yesideez Posted August 3, 2010 Share Posted August 3, 2010 Check the syntax of your MySQL query - check spellings of the table and all field names as something is incorrect. Quote Link to comment https://forums.phpfreaks.com/topic/209650-help-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-1094503 Share on other sites More sharing options...
haighster Posted August 3, 2010 Author Share Posted August 3, 2010 the details can not be wrong as the database is being populated correctly - this is why i am completely lost. The mysql_error is also blank suggesting no errors Quote Link to comment https://forums.phpfreaks.com/topic/209650-help-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-1094507 Share on other sites More sharing options...
Yesideez Posted August 3, 2010 Share Posted August 3, 2010 My bad - mysql_num_rows won't work with UPDATE - missed that first time round. http://php.net/manual/en/function.mysql-num-rows.php This command is only valid for statements like SELECT or SHOW that return an actual result set. Quote Link to comment https://forums.phpfreaks.com/topic/209650-help-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-1094510 Share on other sites More sharing options...
bh Posted August 3, 2010 Share Posted August 3, 2010 Hi, You should get the affected rows when you run UPDATE / DELETE queries. Quote Link to comment https://forums.phpfreaks.com/topic/209650-help-warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result/#findComment-1094514 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.