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 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. 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 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. 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. 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
Archived
This topic is now archived and is closed to further replies.