Thank you nice tutorial well done !
you're welcome![]()
Hello,
thanks for you help...:-)
u rock!
i have a prob wit the while stm, bin tryin to display all da images in da DB table.
bt i only get one back.
thanks
Yes.. with this script you only can display one picture.. You need to edit this script a little if you want to see many pictures..
hi,
thanks for the reply...
im still having probs with displaying all images in the DB...
and how can i show the title and img .........all at one place from the item table(where the images are)
pls take a look at my code below.
it goes thru the loop and displays only the first image the exact number of the images in the DB.
Code:<?php
/////////imgView.php//////
header('Content-type: image/jpeg'); // act as a jpeg file
mysql_connect('localhost','user1','testing')or die(mysql_error());
mysql_select_db('ebayr')or die(mysql_error()); // use the ‘test’ database
$query = 'select * from item';
$result = mysql_db_query('ebayr',$query)or die(mysql_error());
$row = mysql_fetch_array($result);
$img = $row['Picture'];
$title = $row['itemName'];
echo ($title);
echo ($img);
?>Thanks......Code:<?php
///////disAllImages.php////////
$username = "user1";
$password = "testing";
$host = "localhost";
$database = "ebayr";
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());
$query = mysql_query("SELECT * FROM item")or die("Cannot exe----- select the database: ".mysql_error());
while($row = mysql_fetch_array($query)){
$title = $row['itemName'];
echo ($title);
echo "<img src='imgView.php' width=144><br><br>";
//echo = $row["Picture"];
}
?>![]()
Last edited by Jaan; 03-01-2009 at 01:58 PM. Reason: Please use code tags when you're posting your codes!
cool
hello...
pls i still need help on the above problem...
still trying to display all the imges in the DB.
pls take a look at my code above...
thanks
Hmm.. I really don't know is it even possible to display all your images via one file..
hi i am trying to get this tutorial to work with mysqli
here is my code, it works fine in firefox but not in safari. any idea's why?
Code:else
{
$query = "SELECT * FROM `binary` WHERE `id`='".$id."'";
$result = mysqli_query($cxn, $query) or die("Invalid query: " . mysql_error());
$row= mysqli_fetch_assoc($result);
$content = $row['image_name'];
header('Content-type: image/jpg');
echo $content;
}
Last edited by John; 04-08-2009 at 08:11 AM.
Dear Sir,
Many thanks for post the value tutorials in here i really appreciated. but after that i try your code(showimage.php?id=1) it is alway give me download file showimage.php.
My needed could you write me a new tutorial that show all image that i was input to database in the table?
special thanks for reply and spend your valuable time to code for me and other one that need.
Please have a look at my code
Regards,Code:<?
include ("includes/config.php");
include ("includes/function.php");
header('Content-type: image/jpeg');
$query = "SELECT id,imagename,image,description FROM gallery";
$result = mysql_query($query) or die('Error, query failed');
if ( mysql_num_rows($result) == 0)
{
echo "Database is empty<br>";
}
else
{
while ( $row = mysql_fetch_array($result))
{
$id = $row['id'];
$imagename = $row['imagename'];
$image = $row['image'];
$description = $row['description'];
?>
<table border="1">
<tr>
<td><? echo $id; ?></td>
<td><img src="showimage.php?id=<?=$id;?>" width="144" height="165" /></td>
<td><? echo $imagename; ?></td>
<td><? echo $description;?></td>
</tr>
<?
}
}
?>
Steven.
Last edited by steven_elvisda; 04-08-2009 at 02:35 AM.
There are currently 4 users browsing this thread. (0 members and 4 guests)
Bookmarks