0

hi all,
i need to display the images that are saved in the back end. so can any one help me please....

$sql="select * from images";
     mysql_error();  
     $result=mysql_query($sql);

after this wat should be done to display the result obtained images.

5
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by vibhaJ
0

Well more information is needed? Are the images stored in the database themselves or do you have a field in the db that just points to the file location and filename?

1

Hello

I have tackled this problem before, so I can tell you what to do.
Assuming that the images are stored in a database:

<?php
$con = mysql_connect ( $server, $uname, $pass );
if ( !$con )
  die ( mysql_error() );
mysql_select_db ( "images" );
$query = "SELECT * FROM 'images' WHERE 'name' = " . $_GET["name"];
$q = mysql_query ( $query );
if ( !$q )
  die ( mysql_error() );
$row = mysql_fetch_array ( $q );
header ( "Content-type: " . $row["mime"] );
echo $row["data"];
mysql_close ( $con );
?>

If the images are simply referenced in a database, then use a loop to extract the names and generate an <img> tag for each of them.

Hope this helps

0

Images must be stored some where to get it display.
It may be 3 case:
- you can save image in folder
- in database
- you can directly use external link like http://www.abc.jpf as a image src.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.