...

View Full Version : Trying to pull some information from a MYSQL table



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&amp;do=play&amp;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?

bdl
02-09-2010, 09:49 PM
Is there a field named `display` in the `games_list` table?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum