GUIR
11-26-2004, 07:46 AM
I have used the following SQL query using PHP to display "User ID already registered" when a new visitor to my site tries to registered with existing UserId which has been registered to anyone else.
//Code to connect DB
$sql = "SELECT count(userid) FROM customer WHERE userID = \"GUIR\"";
print mysql_query($sql);
//
If value exists it should show "1 or more".
If not it should show "0".
I tried with this query using PHPMyAdmin. It works fine.
But when used with PHP as above it gives the output jargon : "Resource id #4", irrespective of such userID exists or not.
The output given by PHP is always "Resource id#4"; But the exact value must be 0, 1 or more.
When the same query is used with different userID the output is "Resource id#5";.
I've no idea what are these "Resource id"s.
I think therers no wrong with the sql query.
PHP is doing some (I dono);
Can someone pls explain me what is happening and/or are there any alternative Queries to do the same.
Again : The above query works fine with PHPMyAdmin.
Regards.
//Code to connect DB
$sql = "SELECT count(userid) FROM customer WHERE userID = \"GUIR\"";
print mysql_query($sql);
//
If value exists it should show "1 or more".
If not it should show "0".
I tried with this query using PHPMyAdmin. It works fine.
But when used with PHP as above it gives the output jargon : "Resource id #4", irrespective of such userID exists or not.
The output given by PHP is always "Resource id#4"; But the exact value must be 0, 1 or more.
When the same query is used with different userID the output is "Resource id#5";.
I've no idea what are these "Resource id"s.
I think therers no wrong with the sql query.
PHP is doing some (I dono);
Can someone pls explain me what is happening and/or are there any alternative Queries to do the same.
Again : The above query works fine with PHPMyAdmin.
Regards.