I feel like I am missing something stupidly obvious here, I am trying to get the results of an SQL query and then using them in a loop. I feel like I am missing something st
The return type of the $results = mysql_query($query); is a resource of type object. For example:
object(mysqli_result)#3 (5) {
["current_field"] => int(0)
["field_count"] => int(3)
["lengths"] => NULL
["num_rows"] => int(2)
["type"] => int(0)
}
Since, we are only interested with the table data. We have the pass the resource to mysql_fetch_array()
, and other functions for dealing with result tables, to access the returned data according to PHP Docs
We cannot directly use it.
However, If you are having problem understanding the inner working of while loop i will give you an example.
dis())
{
echo $fac."
";
$GLOBALS['s']++;
}
?>