Hi,
I'm trying to get a simple function to work with MySQL inside a class.
Below is the function that won't work properly. Can anyone tell whats wrong with it?
function query()
{
$query = "SELECT * FROM pork ORDER BY id";
$result = mysql_query($query, $connection);
for ($i=0; $i < mysql_num_rows($result); $i++)
{
$pizza_name = mysql_result($result, $i, "pizza_name");
$pizza_desc = mysql_result($result, $i, "pizza_description");
$reg_price = mysql_result($result, $i, "reg_price");
$lge_price = mysql_result($result, $i, "lge_price");
echo '<tr><td width="90%" bgcolor="#000000" valign="center">'.$pizza_name.'</td>';
echo '<td width="10%" bgcolor="#000000" valign="center" align="center">'.$reg_price.'</td></tr>';
}
echo '</table>';
}
I have tried to use an argument for the query function ie. query($table) and used this variable in the mysql statement with all differnent kinds of syntax but nothing seems to work.
On the page that calls this function, the error message i get is...
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/class_table.php on line 17
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/class_table.php on line 19
Can someone help me please?
🙁 Nick