Jump to content

Displaying Image From Database


daebat

Recommended Posts

I'm going to feel stupid when I hear the answer to this question... keep in mind I am a complete php noob... I wrote this script to retrieve various images and links from my database but the variable isn't pulling correctly when I try to link it:

 

<div id="content">
<?php

mysql_connect("localhost", "user", "pdub") or die(mysql_error()) ;
mysql_select_db("database") or die(mysql_error()) ;

?>
<div>
<h1>Print Ads<hr /></h1><br />
<?php
$data = mysql_query("SELECT `printads`.`id`,`printads`.`title`,`printads`.`image`,`printads`.`thumb`,`printads`.`eps1`,`printads`.`eps2`,`printads`.`pdf1`,`printads`.`pdf2` FROM `printads`") or die(mysql_error());


while($info = mysql_fetch_array( $data ))
{


Echo "<table width='200'>";

Echo "<tr><td colspan='2'><a href='..associates_new/upload/printads/".$info['image'] ."><img src='..associates_new/upload/printads/".$info['thumb'] . "</b></td></tr>";
Echo "<tr><td colspan='2' style='text-align:center;'><b> ".$info['title'] . "</b></td></tr> ";
Echo "<tr><td style='vertical-align: middle; text-align:center;'>Color Illustrator Vector EPS</td><td><a href='..associates_new/upload/productads/'".$info['eps1'] . "><img src='../associates_new/images/download.png' border='0' width='75'></a><br></td></tr>";
Echo "<tr><td style='vertical-align: middle; text-align:center;'>Color Press Quality PDF</td><td><a href=".$info['pdf1'] . "><img src='../associates_new/images/download.png' border='0' width='75'></a><br></td></tr>";
Echo "<tr><td style='vertical-align: middle; text-align:center;'>B&W Illustrator Vector EPS</td><td><a href=".$info['eps2'] . "><img src='../associates_new/images/download.png' border='0' width='75'></a><br></td></tr>";
Echo "<tr><td style='vertical-align: middle; text-align:center;'>B&W Press Quality PDF</td><td><a href=".$info['pdf2'] . "><img src='../associates_new/images/download.png' border='0' width='75'></a><br></td></tr>";

Echo "</table>";
}
?> 
</div>

</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>

Link to comment
https://forums.phpfreaks.com/topic/187762-displaying-image-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.