I have a script to display all the entries in a table (which are names of images) and link to another script which then displays the corresponding image to the link you selected.
When I use it however it just gives me a bunch of garbage instead of displaying the image (it looks like it is displaying the image in ASCII).
Here is my code:
display the links
<?php
include("dbconn.php");
$sql="SELECT * FROM tIMG";
$result = mysql_query($sql, $db) or die(mysql_error());
$rows = mysql_num_rows($result);
if ($rows>0 && $myrow = mysql_fetch_array($result)) {
echo "<table class=\"rcoldcss\">\n";
echo "<tr><td>Technical Specifications</td></tr>\n";
do {
printf("<tr><td><a href='pics.php?techimg=%s'>View</a></td></tr>\n", $myrow["tImgs"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
}
?>
display the pics:
<?php
if(!$_GET['techimg']) { // if there is no value for the page variable
include("empire_nc-logo.gif");
} else {
echo "<img src='".$_GET["techimg"]."'"; // the variable.incl
}
?>