forumnz Posted April 30, 2007 Share Posted April 30, 2007 I cant get it to get the image from a DB - help! Thanks. <?php $database=mysql_connect("localhost","designervi_sam", "***"); mysql_select_db("mag",$database); //echo $userid; $query="select * from mag"; $result = mysql_query($query) or die(mysql_error()); while($img=mysql_fetch_assoc($result)){ $image_num=$img['stg1']; echo"<img src='images/" . $image_num . "' />"; }mysql_close ($database); ?> Link to comment https://forums.phpfreaks.com/topic/49270-display-images-from-db/ Share on other sites More sharing options...
AndyB Posted April 30, 2007 Share Posted April 30, 2007 what's the html output from that (via view source) Link to comment https://forums.phpfreaks.com/topic/49270-display-images-from-db/#findComment-241433 Share on other sites More sharing options...
forumnz Posted April 30, 2007 Author Share Posted April 30, 2007 <!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> No database selected Link to comment https://forums.phpfreaks.com/topic/49270-display-images-from-db/#findComment-241434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.