PHP (MySQL) error : "Warning: mysql_num_rows() expects parameter 1 to be resource" [duplicate]

$result is false because your query is invalid (has a syntax error). Use:

$sql = "UPDATE members SET conf=2 WHERE email = '$email_to';"

(note the quotes surrounding $email_to)

Also mysql_num_rows() should be used for SELECT queries only. For UPDATE, INSERT and DELETE, use mysql_affected_rows() instead.

Finally, for future reference, if your query doesn't work, print the error and the SQL query used (something like what's on Col Shrapnel's answer). It will help you know what's wrong.


$result=mysql_query($sql);

to

$result=mysql_query($sql) or trigger_error(mysql_error().$sql);

and run it again

and then

$email_to=$_POST['email_to'];

to

$email_to=mysql_real_escape_string($_POST['email_to']);

oh yes, and there is also quotes