Help wanted

From: Date: Wed, 11 Oct 2000 21:27:13 +0000
Subject: Help wanted
Groups: php.db 
Request: Send a blank email to php-db+get-3531@lists.php.net to get a copy of this message
I can't seem to get this code to work. I've created three db's (one with mineral_info, one with photo-filenames and one with foto_ID's and min_ID's). I want to display the according photo's with the minerals (somethimes there are more photo's) and when there are no corresponding foto_ID or mineral_ID entries in the third db. the last else (echo: No picture available yet!) must be executed. But I keep getting the following error: "Warning: 0 is not a MySQL result index in /home/mineralen/www/php/min_details2.inc on line 14" The strainge part is that the echo-comm. for no image is executed, even if I know there is an image!! I've tried different queries/code but I can't get it to work. Maybe you can help. The script I use is down below. Thanks in advance, Bart <?php $naam_nl = $link; $result = mysql_query ("SELECT * FROM min_data WHERE ID LIKE '$naam_nl'"); if ($row = mysql_fetch_array($result)) { do { echo ("Hier moet de naam staan: " . $row["naam_nl"] . " uit eerste q"); $result_foto = mysql_query ("SELECT bestand, omschrijving, vindplaats, fotograaf FROM min_foto, min_data, foto_ID WHERE foto_ID.foto_ID='$link' AND min_foto.bestand=foto_ID.foto_ID"); if ($row_foto = mysql_fetch_array($result_foto)) { //this line causes error?? do { echo ("<img border='0' src='images/" . $row_foto["bestand"] . ".jpg' align='center' valign='middle'>\n Hier moet de foto staan images/". $row_foto["bestand"] . "."); } while ($row_foto = mysql_fetch_array($result_foto)); } else { echo ("No picture available yet!"); } // echo ("</td>\n"); } while ($row = mysql_fetch_array($result)); } else { print ("Sorry, de door u opgevraagde gegevens zijn niet beschikbaar. Helemaal eind script"); } ?>

« previous php.db (#3531) next »