Re: Help wanted
| From: | Miles Thompson | Date: | Wed, 11 Oct 2000 22:14:39 +0000 |
| Subject: | Re: Help wanted | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3532@lists.php.net to get a copy of this message | ||
Bart,
1. Have you tried these queries interactively at the mysql console and do they
work?
2. Do you have any duplicate field names that may need qualification?
3. Use mysql_num_rows() afer each query to see how many rows are being returned.
That should help diagnose the problem.
Miles Thompson
"Bart A. Verbeek" wrote:
> 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");
> }
> ?>
>
> --
> 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