
June 20th, 2000, 02:31 PM
|
|
Junior Member
|
|
Join Date: Jun 2000
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I have two separate tables in my database - one with information and one with photos. I would like to link the two of these tables together. So when you go to an information page there is a small link that has a link to a photo for that fish. And vise versa when you go to the photos page.
The way I am going to have to link the tables together is by their scientific name. Because that is the only thing that they have in common. I tired something like this:
$result16 = mysql_query("SELECT * FROM photos WHERE $id=id",$db);
$result17 = mysql_query("SELECT * FROM info WHERE $result16=scientific_name",$db);
while ($myrow = mysql_fetch_array($result17)) {
printf("More information about <a href=$info_php?id=%s&author=%s><b>%s</b></a>?", $myrow["id"], $myrow["author_id"], $myrow["common_name"]);
}
I keep getting a 0 result when I do this.
I only want the link to show up if there is information about the fish in the other table. Also, the fields that I am tiring to link have multiple words because they are scientific names.
Does anyone know a better way for me to do this?
Off the subject - In my script I used "SELECT * FROM table". Does it kill a server if you use this A LOT. Sometimes when the script is loading it is being used 6-7 times.
------------------
[This message has been edited by fishindex (edited June 20, 2000).]
|