Jump to content

Display images from DB


forumnz

Recommended Posts

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

<!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

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.