forcerhpool
02-09-2010, 09:07 PM
I am trying to extract some games information from the forum database on my website so i can display a random game in a box on the side.
I dont have much experience doing this so i've made a script pulled from a tutorial:
<?php
include('db.php');
$result = mysql_query("SELECT gname, gtitle, bestscore, gid FROM site_forum.games_list WHERE display = 1 ORDER BY RAND() LIMIT 1") or die(mysql_error());
$num_of_rows = mysql_num_rows ($result);
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$gname=$row[0];
$gtitle=$row[1];
$bestscore=$row[2];
$gameid=$row[3];
echo "<img src=\"/forum/arcade/images/$gname2.gif\" width=\"60\" height=\"60\" /><a href=\"/forum/arcade.php?act=Arcade&do=play&gameid=$gameid\">$gtitle</a>";
}
?>
gives the error:
Unknown column 'display' in 'where clause'
I only want to display an image with the name and score underneath so i need the following rows:
gid, best score, gname, gtitle
from table games_list
in the database site_forum
where am i going wrong?
I dont have much experience doing this so i've made a script pulled from a tutorial:
<?php
include('db.php');
$result = mysql_query("SELECT gname, gtitle, bestscore, gid FROM site_forum.games_list WHERE display = 1 ORDER BY RAND() LIMIT 1") or die(mysql_error());
$num_of_rows = mysql_num_rows ($result);
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$gname=$row[0];
$gtitle=$row[1];
$bestscore=$row[2];
$gameid=$row[3];
echo "<img src=\"/forum/arcade/images/$gname2.gif\" width=\"60\" height=\"60\" /><a href=\"/forum/arcade.php?act=Arcade&do=play&gameid=$gameid\">$gtitle</a>";
}
?>
gives the error:
Unknown column 'display' in 'where clause'
I only want to display an image with the name and score underneath so i need the following rows:
gid, best score, gname, gtitle
from table games_list
in the database site_forum
where am i going wrong?