Forums

PHP

This topic is locked

Dynamic image syntax for beginners...

Posted 31 Oct 2006 17:24:30
1
has voted
31 Oct 2006 17:24:30 Øyvind Sagåsen posted:
Hi

Fairly new at this, but at least able to fetch a an image string from my MYSQL<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> The problem comes when I try to insert an "if / else" statement in case someone has chosen "no picture" (value = 0) on the previous form.

So... what's wrong eith the syntax in the "img src" here:

&lt;?php
$valgt = ($_GET['strip1']);
if ($valgt = "0"
echo '';
else
echo '&lt;img src="images/tegneserier/&lt;?php echo $row_Strip1_set['stripemappe_farger']; ?&gt;01.gif" /&gt;';?&gt;

It returns the following error: "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in (*name of directory*) on line 92"

But if I change the dynamic content in the img string in the last line, everything comes up just fine.

Any suggestions would be greatly appreciated!

Replies

Replied 31 Oct 2006 18:16:41
31 Oct 2006 18:16:41 Roddy Dairion replied:
try this
<pre id=code><font face=courier size=2 id=code>
&lt;?php
$valgt = $_GET['strip1'];
if ($valgt == "0"
{
echo '';
}
else
{
echo "&lt;img src='images/tegneserier/'.$row_Strip1_set['stripemappe_farger'].'01.gif' /&gt;";
}
?&gt;
</font id=code></pre id=code>
Replied 31 Oct 2006 21:16:17
31 Oct 2006 21:16:17 Øyvind Sagåsen replied:
Bullseye!

Thank you sooooo much!

Reply to this topic