1

I'm completely out of ideas as to what's happening here.

Here's my code:

    $sid = "123";
    $sid_query_conf = mysql_query("SELECT email FROM users WHERE sid='$sid'");
if(!$sid_query_conf)
    die(mysql_error());

$result = mysql_fetch_assoc($sid_query_conf);

if(mysql_num_rows($result) == 0)
    die("Error processing your details");

It's consistently returning "Error processing your details" where is phpMyAdmin I get the result that I'm looking for. There's even 1 query before this so I know that the connection it works in that respect.

I've even tried to just select everything from the table and it's still returning no rows. mysql_fetch_result also did nothing.

I could really do with some help as to what's happening to make it not work like this.

4

1 回答 1

5

I believe mysql_num_rows($result) should be mysql_num_rows($sid_query_conf)

Also you shouldnt be using mysql_* functions anymore as they are deprecated, use PDO or mysqli instead.

http://php.net/manual/en/function.mysql-num-rows.php

于 2013-06-08T16:01:42.143 回答