Forum Moderators: coopster
if i try retrieving only the picture field with the code below in an html file it works
<img src="ame2.php?pid=<?php echo $pid ='6'?>">
the file "ame2.php" uses pid identify row to display and in this case pid=6.
but does not work with the php script below. what am i getting wrong, what should i do,Pls help!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gozmok", $con);
$result = mysql_query("select albumid, album_title, total_tracks, duration, media_category, price from albums");
echo "<table width='90%' border='1' cellpadding='0'>
<tr>
<th></th>
<th></th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo ('<tr>');
$pid=$row['albumid'];
$image ='<br><img src="ame2.php?pid=$pid">';
echo ('<td ><b>'."Title: ".$row['album_title'] .$image ." <br>Price: ". $row['price'] . '</b></td>');
echo ('<td>'."No of Tracks: ". $row['total_tracks'] ."<br>Media Type: ". $row['media_category'] ."<br> Play Time: ". $row['duration'] . '<br><a href="albumdetails.php?id=.$pid">More</a>'.'</td>');
echo ("</tr>");
}
echo "</table>";
mysql_close($con);
?>
</body>
</html>
pls any assistance will be appreciated.
Hope that makes sense.
echo "$var"; // ok
echo '$var'; //not ok
Should be:
$image ='<br><img src="ame2.php?pid='.$pid.'">';
dc