Webmaster's Community

Designing and Development => Programming => Topic started by: rahul on October 09, 2012, 11:56:00 AM

Title: what is Resource id #4 in mysql
Post by: rahul on October 09, 2012, 11:56:00 AM
HI all,
              i make a query in sql like
Code: [Select]
$query  = "SELECT * FROM users
WHERE id = 1";
$res = mysql_query($query);
echo $res;


it shows Resource id #4 if i change id 1 to 100 mean empty result still this shows Resource id #4 can some one make me clear that what this Resource id in mysql and how to check $res is empty or not..

Thanks in Advance
Title: Re: what is Resource id #4 in mysql
Post by: Savera on October 10, 2012, 05:00:38 AM
Resource is something like reference to result you received from mysql after query, so think it as location where result is saved by mysql after you ask for, now you have to go to that resource and get the information which we do using mysql_fetch_assoc() or similar..
Title: Re: what is Resource id #4 in mysql
Post by: rahul on October 20, 2012, 08:38:40 AM
thanks for you reply

But there are only two records in my table how could be this possible to find 4 resources and some time i saw Resource  id #22 as well any other idea please help