Wasserlasser Posted January 30, 2022 Share Posted January 30, 2022 Hi, <table border=1> <? $a = '1'; $b = '2'; ?> <tr> <td id="2"> <? echo $vorname[$a] ?> <br> <? echo $name[$a] ?> </td> <td><img src="<? echo $bild[$a]; ?>"></td> <td id="2"> <? echo $vorname[$b] ?> <br> <? echo $name[$b] ?> </td> <td><img src="<? echo $bild[$b]; ?>"></td> <tr><td id="2">Nick:</td><td id="4"><? echo $nick[$a] ?></td> <td id="2">Nick:</td><td id="4"><? echo $nick[$b] ?></td> <tr><td id="2">Geburtstag:</td><td id="4"><? echo $geb[$a] ?></td> <td id="2">Geburtstag:</td><td id="4"><? echo $geb[$b] ?></td> <tr><td id="2">Wohnort:</td><td id="4"><? echo $ort[$a] ?></td> <td id="2">Wohnort:</td><td id="4"><? echo $ort[$b] ?></td> <tr><td id="2">Hobby:</td><td id="4"><? echo $hobby[$a] ?></td></td> <td id="2">Hobby:</td><td id="4"><? echo $hobby[$b] ?></td> <tr><td id="2">Torrausch-Verein:</td><td id="4"><? echo $club[$a] ?></td> <td id="2">Torrausch-Verein:</td><td id="4"><? echo $club[$b] ?></td> <tr><td id="2">Liga:</td><td id="4"><? echo $liga[$a] ?></td> <td id="2">Liga:</td><td id="4"><? echo $liga[$b] ?></td> <tr><td id="2">Seit wann<br>bei Torrausch:</td><td id="4"><? echo $date[$a] ?></td> <td id="2">Seit wann<br>bei Torrausch:</td><td id="4"><? echo $date[$b] ?></td> <tr><td id="2">Wie zu Torrausch<br>gekommen:</td><td id="4"><? echo $wie[$a] ?></td> <td id="2">Wie zu Torrausch<br>gekommen:</td><td id="4"><? echo $wie[$b] ?></td> <tr><td id="2">Beruf:</td><td id="4"><? echo $beruf[$a] ?></td> <td id="2">Beruf:</td><td id="4"><? echo $beruf[$b] ?></td> <tr><td id="2">Sonstiges:</td><td id="4"><? echo $sonstiges[$a] ?></td> <td id="2">Sonstiges:</td><td id="4"><? echo $sonstiges[$b] ?></td> <tr><td id="2">Mailadresse:</td><td id="4"><? echo $mail[$a] ?></td> <td id="2">Mailadresse:</td><td id="4"><? echo $mail[$b] ?></td> </table><p><p> This code does not display the picture, even though the picture address is correct when I click on the missing picture icon and copy the image location. Any ideas why? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/ Share on other sites More sharing options...
requinix Posted January 30, 2022 Share Posted January 30, 2022 Pretty sure some fact here isn't quite as you think it is. Check the browser's error console for messages. Also check the network requests to see if there's something that stands out there. Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593725 Share on other sites More sharing options...
ginerjm Posted January 30, 2022 Share Posted January 30, 2022 Here is your code, a little cleaned up and more readable. $a = '1'; $b = '2'; $code=<<<heredocs <table border=1> <tr> <td id="2"> {$vorname[$a]}<br>{$name[$a]}</td> <td><img src="{$bild[$a]}"></td> <td id="2">{$vorname[$b]}<br>{$name[$b]}</td> <td><img src="{$bild[$b]}"></td> <tr> <td id="2">Nick:</td> <td id="4">{$nick[$a]}</td> <td id="2">Nick:</td> <td id="4">{$nick[$b]}</td> <tr> <td id="2">Geburtstag:</td> <td id="4">{$geb[$a]}</td> <td id="2">Geburtstag:</td> <td id="4">{$geb[$b]}</td> <tr> <td id="2">Wohnort:</td> <td id="4">{$ort[$a]}</td> <td id="2">Wohnort:</td> <td id="4">{$ort[$b]}</td> <tr> <td id="2">Hobby:</td> <td id="4">{$hobby[$a]}</td></td> <td id="2">Hobby:</td> <td id="4">{$hobby[$b]}</td> <tr> <td id="2">Torrausch-Verein:</td> <td id="4">{$club[$a]}</td> <td id="2">Torrausch-Verein:</td> <td id="4">{$club[$b]}</td> <tr> <td id="2">Liga:</td> <td id="4">{$liga[$a]}</td> <td id="2">Liga:</td> <td id="4">{$liga[$b]}</td> <tr> <td id="2">Seit wann<br>bei Torrausch:</td> <td id="4">{$date[$a]}</td> <td id="2">Seit wann<br>bei Torrausch:</td> <td id="4">{$date[$b]}</td> <tr> <td id="2">Wie zu Torrausch<br>gekommen:</td> <td id="4">{$wie[$a]}</td> <td id="2">Wie zu Torrausch<br>gekommen:</td> <td id="4">{$wie[$b]}</td> <tr> <td id="2">Beruf:</td> <td id="4">{$beruf[$a]}</td> <td id="2">Beruf:</td> <td id="4">{$beruf[$b]}</td> <tr> <td id="2">Sonstiges:</td> <td id="4">{$sonstiges[$a]}</td> <td id="2">Sonstiges:</td> <td id="4">{$sonstiges[$b]}</td> <tr> <td id="2">Mailadresse:</td> <td id="4">{$mail[$a]}</td> <td id="2">Mailadresse:</td> <td id="4">{$mail[$b]}</td> </table> <p><p> heredocs; echo $code; You have a few html errors in your table. Also a bad TD tag in one place as well as a bunch of missing tags. As for your missing img - does the rest of the table show up at all? 1 Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593727 Share on other sites More sharing options...
Barand Posted January 30, 2022 Share Posted January 30, 2022 Not to mention a complete disregard for the fact that id values should be unique. 1 Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593729 Share on other sites More sharing options...
ginerjm Posted January 30, 2022 Share Posted January 30, 2022 (edited) Did all that copying and never noticed that he was using id values. Whatever for I wonder? Try adding an alt attribute to the img tag. <td><img src="{$bild[$a]}" alt="img {$bild[$a]} not shown"></td> Let's see if there is a reason behind it not showing or simply an error in your reference. Edited January 30, 2022 by ginerjm 1 Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593730 Share on other sites More sharing options...
Wasserlasser Posted January 30, 2022 Author Share Posted January 30, 2022 Thanks so much for all your answers. I have taken this over from someone and I am trying to clean this up. With that being said, I am not a programmer (surprise), so I am learning as I go. I will check your code and get back to you asap. Wasserlasser Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593747 Share on other sites More sharing options...
Wasserlasser Posted January 30, 2022 Author Share Posted January 30, 2022 @ginerjm Thanks for the code, but there are no echos in your code, so of course nothing is displaying Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593750 Share on other sites More sharing options...
ginerjm Posted January 30, 2022 Share Posted January 30, 2022 (edited) My code is using the heredocs operator to avoid all the echos. If you look it up in the manual you can see how it works. My code should work just fine except if a I have any typos of my own. You have to be php mode for ALL of it. If it doesn't work, post it again as is and let's see it. And be sure that the heredocs; line is in column 1 !!! I do see where the image tags are showing but since you didn't provide any size values it may not be showing. Do an echo of your img tag src value so you can see what the actual image file name looks like. Edited January 30, 2022 by ginerjm 1 Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593751 Share on other sites More sharing options...
Wasserlasser Posted January 30, 2022 Author Share Posted January 30, 2022 (edited) And I just learned something, thank you. It is in fact now displaying data, but not all pictures. I get the data from another file in the same directory <? require ("ll_daten.php"); ?> And for 1 and 2 it is this code // Topse $vorname[1] = "Tobias"; $name[1] = "Hannibal"; $nick[1] = "Topse"; $bild[1] = "http://torrausch.net/portal/bilder_LL/topse2.jpg"; $geb[1] = "21.11.1970"; $ort[1] = "Velbert"; $hobby[1] = "meine 5 Kinder<br>Fussball<br>Computer<br>Badminton"; $club[1] = "Derby County FC"; $liga[1] = "<a href='http://europapkal.torrausch.net'>Europapokal</a>"; $date[1] = "September 2002<br>seit November 2003 LL"; $wie[1] = "über einen Freund"; $beruf[1] = "BIM Manager"; $sonstiges[1] = "Zebra Fan"; $mail[1] = "<a href='mailto:topse@torrausch.net'>Topse</a>"; // Thies $vorname[2] = "Thies"; $name[2] = "Petersen"; $nick[2] = "Thies"; $bild[2] = "http://torrausch.net/portal/bilder_LL/thies4.jpg"; $geb[2] = "19.09.1980"; $ort[2] = "Kiel/Rendsburg"; $hobby[2] = "Tischtennis<br>Internet<br>HSV"; $club[2] = "Leicester City FC"; $liga[2] = "<a href='http://tuerkei.torrausch.net'>Türkei</a><br><a href='http://portugal.torrausch.net'>Portugal</a>"; $date[2] = "27.10.2002<br>seit 10.03.2003 LL"; $wie[2] = "über einen PbeM<br>verrückten Typ"; $beruf[2] = "Student"; $sonstiges[2] = "HSV-Mitglied<br>Der Unabsteigbare"; $mail[2] = "<a href='mailto:thies@torausch.net'>Thies</a>"; Why this does not work for the second one is beyond me. UPDATE After clearing the CACHE, I get this Edited January 30, 2022 by Wasserlasser Quote Link to comment https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/#findComment-1593752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.