I am try to fetch data from the database
$check_sql = 'SELECT * FROM table;
$check_result = mysql_query($check_sql);
echo $check_result;
$result = mysql_fetch_array($check_result);
when I echo $check_result
, it shows 'Resource id 2', which i think it means there exists a return array, but when I use mysql_fetch_array
, it will return a null value, and I don't know why...
And I found that no matter whether there exists the resules or not, echo $check_result
would always shows 'Resource id#2', does this sentence in mysql mean 'no results' ? Could someone help???
In case if you are dealing with multiple rows in your mysql query you need to use code like this:
while ($row = mysql_fetch_array($check_result) )
{
echo $row['ROW_NAME_HERE'];
}
I guess it is why you mentioned mysql_fetch_array function.
mysql_fetch_array()
returns an array. You definitely must take a look at documentation http://php.net/mysql_fetch_array
Try print_r($result);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.