Page 1 of 1

Warning: mysql_num_rows(): supplied argument is not a valid

Posted: Thu Jul 21, 2011 1:44 am
by tobymac
I know it is something easy to fix. This is a "forgot password" form for my website. the error i get is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ... on line 12. what is the problem and how can i fix it so it sends?


<?php $outputForUser = ""; if ($_POST[' ... y> </html>

Re: Warning: mysql_num_rows(): supplied argument is not a va

Posted: Thu Jul 21, 2011 2:41 am
by social_experiment

Code: Select all

<?php
$sql = mysql_query("SELECT * FROM members WHERE email='$email' AND email_activated='1'"); 
echo $sql;
?>
What is displayed if you print the query

Re: Warning: mysql_num_rows(): supplied argument is not a va

Posted: Thu Jul 21, 2011 7:15 pm
by tobymac
it's the same thing...

Re: Warning: mysql_num_rows(): supplied argument is not a va

Posted: Thu Jul 21, 2011 7:20 pm
by tobymac
Am i missing a myql form entry?

Re: Warning: mysql_num_rows(): supplied argument is not a va

Posted: Thu Jul 21, 2011 7:45 pm
by beetree
Try printing the query from the PHP script. Then run the same query in MySQL manually and see if it returns any results. Faults could be:

1. Miss-typed argument names
2. Miss-typed table name
3. $email containing bad characters e.g. '

/Johan

Re: Warning: mysql_num_rows(): supplied argument is not a va

Posted: Fri Jul 22, 2011 2:56 am
by social_experiment
social_experiment wrote:What is displayed if you print the query
beetree wrote:Try printing the query from the PHP script.
If you print the query you will see what the query looks like when it is passed to the database, from there it will be easier to find an answer to your question. Paste the results here :)