Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Posts
    126
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Trying to pull some information from a MYSQL table

    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:

    Code:
    <?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?

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Is there a field named `display` in the `games_list` table?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •