Hi all -
I'm hoping someone here can help me with this as I have been trying to figure it out for the past 48 hours and have made little progress.
I have two table in my database. The Primary Key (Serial) in tblTitles is the Foreign Key(Serial) in tblQuotes.
Running the following code will list everything properly. But it lists EVERY row from the database.

$query = "SELECT * from tblQuotes, tblTitles WHERE tblQuotes.Serial = tblTitles.Serial"; //Make the query
$result = @mysql_query ($query); // Run the query
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
	echo "<a href='./clips/{$row['FileDirectory']}/{$row['Serial']}/{$row['FileName']}.wav'>{$row['Quote']}</a> <br>" .
                "{$row['Title']},  {$row['FileSize']}kb <br><br>";
	}

What I want is to only list information based on the Serial entry (there are over 2300 rows in the database and over 190 different Serial entries.) I've tried a number of different ways, but I can't get any records to list on the web page. I'm fairly new to this so please dummy it down for me.

Latest attempt:

$serial = $_GET['Serial'];
$query = "SELECT * FROM tblDWWA INNER JOIN tblTitles ON tblDWWA.Serial = tblTitles.Serial WHERE Serial = $serial"; //Make the query
$result = @mysql_query ($query); // Run the query 
  while($row = @mysql_fetch_array($result))	{
	echo "<a href='./clips/{$row['FileDirectory']}/{$row['Serial']}/{$row['FileName']}.wav'>{$row['Quote']}</a> <br>" .
       "{$row['Title']},  {$row['FileSize']}kb <br><br>";
	}

Running the following code will list everything properly. But it lists EVERY row from the database.
$query = "SELECT * from tblQuotes, tblTitles WHERE tblQuotes.Serial = tblTitles.Serial";

The above query is perfect and i dont know WHY it lists every row !

In your second attempt you are using Serial in your WHERE clause which is an ambiguous field. So just pick a table and use that as the parent to the field. IE., tblQuotes.Serial

This question has already been answered. Start a new discussion instead.