Log in

View Full Version : a href filling info from mysql



e1seix
07-25-2007, 02:10 PM
where am i going wrong in my syntax here? while the link appears to work, none of the imagery called from the database does. help appreciated

$fetch = mysql_query("SELECT * FROM fragrances WHERE ID=$ID LIMIT $startrow, 6")or
die(mysql_error());

$ima_link=$row['ima_link'];
$sku=$row['sku'];
$title=$row['title'];

echo "<table class='main_table'>";
while($row = mysql_fetch_array( $fetch )) {
// Print out the contents of each row into a table
echo "<tr><td class='image_td' rowspan='2' valign='top'>";
echo '<a href="'.$_SERVER['PHP_SELF'].'?sku='.$sku.'"><img alt="'.$title.'" src="'.$_SERVER['PHP_SELF'].'/images/'.$ima_link.'" /></a>';
echo "</td><td class='title_td' valign='top'>";
echo $row['title'];
echo "</td><td class='type_td' rowspan='2' valign='top'>";
echo $row ['size']. " ". $row['type'];
echo "<p class='rrp'>RRP &#163;";
echo $row['rrp'];
echo "</p><p class='&#163;'>DFUK &#163;";
echo $row['&#163;'];
echo "</p><p class='store'>";
echo $row['SHO'];
echo "</p><p class='buttons'>";
echo $row ['cli_link']. $row['buy_link'];
echo "</p></td></tr><tr><td class='manufacturer_td' valign='top'>";
echo $row['manufacturer'];
echo "</td></tr><tr><td class='hr_td' colspan='3' valign='top'>&nbsp;";
echo "</td></tr>";
}

echo "</table>";

jonnyynnoj
07-26-2007, 06:25 PM
Surely these three lines:

$ima_link=$row['ima_link'];
$sku=$row['sku'];
$title=$row['title'];

Should come after:

while($row = mysql_fetch_array( $fetch )) {