What's the best way to store a MySQL result set (with multiple rows in the set) in a PHP variable?
What is a PHP storable variable?
Sorry. Weird wording:
How do I store a MYSQL result set (with multiple rows in that set) in a PHP variable?
According to your explanation...
// Now mysql result set is stored in php variable.
$result = mysql_query("SELECT * FROM foo");
Or if you meant that you want the rows as an array. Then you need to loop through the result set.
$array = array();
while($row = mysql_fetch_object($result))
$array = $row;
Or you mean something else...? I am confused..
$result = mysql_query($querystring, $dbconn)
Thanks, TeNDoLLA. Your second example is perfect. Just serialize() that $array to store it in a PHP variable.
Solved! Thanks again all! You guys rock!
Do you perhaps mean string when you say variable?
Otherwise $result, $row, $array are all 'variables' anyway.
This topic is now closed. New replies are no longer allowed.