php store mysql query result in array variable code example
Example 1: php fetch mysql result as variable
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
?>
Example 2: php variable inside mysql query
String : echo "Hello {$var}";
Sql : $query = "SELECT * FROM `table` ORDER BY `$orderby`";