how to display image and other detail from the database using php
my db table table name 'store'
id | regno | name | image
------------------------------
1 | 101 | xxxxx | myimage
Here i able to search the particular image from the db but i need to
display all the details such as regno, name, and image in same form please
any body help me
table.php
<form action ="table.php" method="post">
search :<input type="text" name="search">
<input type="submit" name="submit">
</form>
<?php
echo $search =$_POST['search'];
?>
<table align="center" cellspacing="0" cellpadding="5" bgcolor="#ffffff"
border=1 bordercolor="#2696b8">
<tr>
<td align="center" width="45" height="45"><img src="image.php?reg=<?php
echo $search?>">
</tr>
</table>
image.php
<?php
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("databaseimage") or die(mysql_error());
$sql ="select * from store where reg= '".intval($_GET['reg'])."' ";
$result = mysql_query($sql) or die(mysql_error());
header('Content-Type: image/png');
echo mysql_result($result, 0);
if($result){
$row = mysql_fetch_row($result);
echo $row['image'];
}
else
{
echo readfile('/your/path/error/image.png');
}?>
in this query i cannot able to display the image please help me
No comments:
Post a Comment