Jump to content

Recommended Posts

Hi,

 

<table border=1>
<?
$a = '1';
$b = '2';
?>

<tr>	<td id="2">&nbsp;<? echo $vorname[$a] ?>&nbsp;<br>&nbsp;<? echo $name[$a] ?>&nbsp;</td>
	<td><img src="<? echo $bild[$a]; ?>"></td>
	<td id="2">&nbsp;<? echo $vorname[$b] ?>&nbsp;<br>&nbsp;<? echo $name[$b] ?>&nbsp;</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

Link to comment
https://forums.phpfreaks.com/topic/314480-picture-with-variable-is-not-displaying/
Share on other sites

Here is your code, a little cleaned up and more readable.

$a = '1';
$b = '2';
$code=<<<heredocs
	<table border=1>
	<tr>
	<td id="2">&nbsp;{$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?

  • Like 1

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 by ginerjm
  • Like 1

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

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 by ginerjm
  • Thanks 1

And I just learned something, thank you. 
It is in fact now displaying data, but not all pictures.

image.png.0f1e95f9488ef002e14bf63c50f119a1.png

 

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

image.thumb.png.e549909d6e4e1eb902bb48bab03704c3.png

Edited by Wasserlasser
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.