PDA

View Full Version : php help



Swearwolf
19-01-2008, 05:12 PM
Why does this just display the name of the rare rather then the picture :(


function displayRares($type, $limit) {
$raresQuery = mysql_query("SELECT * FROM `rares` WHERE type='$type' LIMIT $limit");
echo "<table border='0'>";
while ($rows = mysql_fetch_array($raresQuery)) {
echo "<tr>";
echo "<td>";
if (!empty($rows['url'])) { echo("<img src=\"" . $rows['url'] . "\" alt=\"" . $rows['name'] . "\".gif />"); }
echo "</td><td>";
if (!empty($rows['name'])) { echo($rows['name']); }
echo "</td>";
if (!empty($rows['t'])) { echo("<td>" . $rows['t'] . "T</td>"); }
if (!empty($rows['hc'])) { echo("<td>" . $rows['hc'] . "HC</td>"); }
if (!empty($rows['rd'])) { echo("<td>" . $rows['rd'] . "RD</td>"); }
echo "</tr>";
}
echo '</table>';
}

Jme
19-01-2008, 05:16 PM
Well that owuld be because you have put the extention after the alt, so it's not grabbing the image properly..


function displayRares($type, $limit) {
$raresQuery = mysql_query("SELECT * FROM `rares` WHERE type='$type' LIMIT $limit");
echo "<table border='0'>";
while ($rows = mysql_fetch_array($raresQuery)) {
echo "<tr>";
echo "<td>";
if (!empty($rows['url'])) { echo("<img src=\"" . $rows['url'] . ".gif \" alt=\"" . $rows['name'] . "\" />"); }
echo "</td><td>";
if (!empty($rows['name'])) { echo($rows['name']); }
echo "</td>";
if (!empty($rows['t'])) { echo("<td>" . $rows['t'] . "T</td>"); }
if (!empty($rows['hc'])) { echo("<td>" . $rows['hc'] . "HC</td>"); }
if (!empty($rows['rd'])) { echo("<td>" . $rows['rd'] . "RD</td>"); }
echo "</tr>";
}
echo '</table>';
}
Try that..

Want to hide these adverts? Register an account for free!