i want to display all images stored in mysql database but it is displaying small crosses in place of image. here is my code. please help me.
i want to display all images stored in mysql database but it is displaying small crosses in place of image. here is my code. please help me.
I think I see what the problem is. There is absolutely no code in your post!
Try writing some code to retrieve the image from the database. Can refer to the MySQL manual for assistance. http://dev.mysql.com/doc/refman/5.1/en/index.html
I got it to work this morning thx 4 the reply though. Did some searching and figured out that the content type i waz using waz not image
<?php
$username = "user";
$password = "password";
$host = "localhost";
$database = "database";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$id = $_GET['id'];
if(!isset($id) || empty($id)){
die("Please select your image!");
}else{
$query = mysql_query("SELECT * FROM restaurants WHERE restid='".$id."'");
$row = mysql_fetch_array($query);
$logo = $row['logo'];
header('Content-type: image/jpg');
echo $logo;
}
?>
Last edited by thuggest_1; Mar 17, 2009 at 10:19 AM.
oh dear....thx 4 da heads up guys....wat would be safer 2 use....plz 2 send me bac 2 guh read
|--- www.RealJamaicaEstate.com ™ ---|
Invest small = small returns [micro enterprise] | Invest Big = returns Big [macro enterprise]
--- www.fashionsJAMAICA.com ™ -|- www.ChampsJamaica.com ™
thx. Didnt even realize the mistake
It's strange, i did this in ASP.NET 2 days ago. It's the same thing but diff language