Jump to content

[SOLVED] help on selecting a single unquie record


pumaf1

Recommended Posts

Hi All,

I am trying to make an "application" on my website.

What I am trying to write is a results database that pulls data from F1 races to a web page. the system will therefore have more than one instance of each team.

what I want it to do, is look at the db and select one instance, and one instance only, not list the whole lot. You can see what It is doing here   http://www.pumaf1.org.uk/res/infobase/teamall.php

 

the code i have so to select the data from the db is:

 

 // connect to the server
   mysql_connect( '', '', '' )
      or die( "Error! Could not connect to database: " . mysql_error() );
   
   // select the database
   mysql_select_db( '')
      or die( "Error! Could not select the database: " . mysql_error() );
   
   // retrieve all the rows from the database
   $query = "SELECT * FROM `infobase` ORDER BY team asc";
   
   $results = mysql_query( $query );

   // print out the results
   if( $results )
   {
?>

$query = "SELECT * FROM 'infobase' ORDER BY team asc";

 

if anyone could help me it would be greatly taken

 

Link to comment
Share on other sites

sorry should have put the resolution, my apologies

From

   // retrieve all the rows from the database
   $query = "SELECT * FROM `infobase` ORDER BY team asc";

 

to

   // retrieve all the rows from the database
   $query = "SELECT * FROM infobase";
   $query = "SELECT DISTINCT team FROM infobase ORDER BY team asc";
  

 

dave

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.