Pls help this is urgent!
<?php
//header('Content-Type: image/jpeg');
header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result)){
print $row[p_painting_id]."</br>";
//print $row[p_painting_image];
}
?>
this code displays all the painting ids available in the table 'gallery'.
but the below coding doesnt display all the corresponding images(of blob type).
Please tell em why.thanks in advance!!!
<?php
header('Content-Type: image/jpeg');
//header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result)){
//print $row[p_painting_id]."</br>";
print $row[p_painting_image];
}
?>
Blob does not display multiple images from mysql database
Moderator: General Moderators
-
WebbieDave
- Forum Contributor
- Posts: 213
- Joined: Sun Jul 15, 2007 7:07 am
Re: Blob does not display multiple images from mysql database
Could you properly indent your code and display it within php tags? It will make it much easier for us to read. Have a look at the posting guidelines for more info:
viewtopic.php?f=1&t=8815
viewtopic.php?f=1&t=8815
Re: Blob does not display multiple images from mysql database
Pls help this is urgent!
<?php
//header('Content-Type: image/jpeg');
header('Content-Type: text/html');
//database connectivity
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
//getting results from database table
$result = mysql_query("SELECT * FROM paintings");
//displaying the IDs of all the images available in the table
while($row = mysql_fetch_assoc($result))
{
print $row[p_painting_id]."</br>";
//print $row[p_painting_image];
}
?>
this code works and displays all the painting ids available in the table 'gallery'.
but the below coding doesnt display ALL the corresponding images(of blob type). it only displays just one image.
Please tell em why.thanks in advance!!!
<?php
header('Content-Type: image/jpeg');
//header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result))
{
//print $row[p_painting_id]."</br>";
print $row[p_painting_image];
}
?>
hey hope this is clearer
<?php
//header('Content-Type: image/jpeg');
header('Content-Type: text/html');
//database connectivity
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
//getting results from database table
$result = mysql_query("SELECT * FROM paintings");
//displaying the IDs of all the images available in the table
while($row = mysql_fetch_assoc($result))
{
print $row[p_painting_id]."</br>";
//print $row[p_painting_image];
}
?>
this code works and displays all the painting ids available in the table 'gallery'.
but the below coding doesnt display ALL the corresponding images(of blob type). it only displays just one image.
Please tell em why.thanks in advance!!!
<?php
header('Content-Type: image/jpeg');
//header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result))
{
//print $row[p_painting_id]."</br>";
print $row[p_painting_image];
}
?>
hey hope this is clearer
Re: Blob does not display multiple images from mysql database
You can only display 1 image at a time from a PHP script. You should be using HTML to set up multiple calls to your server, eg
Then 'image.php' would fetch the image with the id of whatever $_GET['id'] is.
Code: Select all
<img src="image.php?id=1">
<img src="image.php?id=2">
<img src="image.php?id=3">
<img src="image.php?id=4">
<img src="image.php?id=5">
Re: Blob does not display multiple images from mysql database
thanks I'l try that out!