•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,760 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 540 | Replies: 3 | Solved
![]() |
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.
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:
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.
php Syntax (Toggle Plain Text)
$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:
php Syntax (Toggle Plain Text)
$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>"; }
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Apr 2005
Location: New York state
Posts: 487
Reputation:
Rep Power: 5
Solved Threads: 73
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 GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h-->++ r z+*
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h-->++ r z+*
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- I NEED HELP PLEASE:Warning: mysql_num_rows(): (PHP)
- I NEED HELP PLEASE:Warning: mysql_num_rows(): (MySQL)
Other Threads in the PHP Forum
- Previous Thread: Delete temporary file on users machine?
- Next Thread: PHP Includes Apache 1.3.33 and a Mac



Linear Mode