mat
09-04-2002, 12:32 AM
I am trying to output a variable into an <img tag and add a string onto the end,
So the variable is called $pic and has the value = images/rt1
I want to add "_small.jpg" onto that and put in an image source
This is my code:
<?php
mysql_connect('localhost', 'mine', 'mine');
mysql_select_db('mine');
$sql = "SELECT * FROM pots";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)){
$potName = $row['potName'];
$pic = $row['image'];
$ID = $row['potID'];
echo "name $potName<br>";
echo "<A HREF='detail.php?ID=$ID' target='popup' onClick='window.open('detail.php?ID=$ID','popup','width=330,height=430') return false'><img src="'$pic'_small.jpg"></a>";
}
?>
You can see the image is supposed to link to a pop up (big version)
Obviously this is wrong, i have tried all the different ways i can think of and i still get an error.
How can i do this?
mat,
So the variable is called $pic and has the value = images/rt1
I want to add "_small.jpg" onto that and put in an image source
This is my code:
<?php
mysql_connect('localhost', 'mine', 'mine');
mysql_select_db('mine');
$sql = "SELECT * FROM pots";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)){
$potName = $row['potName'];
$pic = $row['image'];
$ID = $row['potID'];
echo "name $potName<br>";
echo "<A HREF='detail.php?ID=$ID' target='popup' onClick='window.open('detail.php?ID=$ID','popup','width=330,height=430') return false'><img src="'$pic'_small.jpg"></a>";
}
?>
You can see the image is supposed to link to a pop up (big version)
Obviously this is wrong, i have tried all the different ways i can think of and i still get an error.
How can i do this?
mat,