Re: Help wanted

From: Date: Thu, 12 Oct 2000 08:40:55 +0000
Subject: Re: Help wanted
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-3539@lists.php.net to get a copy of this message
I would guess it's your "if"s (haven't checked the rest of your code but that'll get the logic working). An if condition should be in the format if ($a == $b) { Note the two "=" signs, a single "=" assigns a value do something } else { This bit is optional do somthing else } See www.php.net for more info. Derek ----- Original Message ----- From: "Bart A. Verbeek" <bodemschat@home.nl> To: "PHP-DB mailinglist" <php-db@lists.php.net> Sent: Wednesday, October 11, 2000 10:27 PM Subject: [PHP-DB] Help wanted > 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)) { file://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"); > } > ?> > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#3539) next »