Jump to content

how to view... in a table


arden
 Share

Recommended Posts

i stored a blob (image/a jpg file) into mysql database "pix",table upload idnametypesizecontenthow can i view it?..i got a script but it only show 1 image..

<?php$id= "4";$con= mysql_connect("localhost","root","pass")or die(mysql_error());mysql_select_db("pix", $con) or die (mysql_error());$query = "SELECT * FROM upload";      $result = mysql_query($query);if($row = mysql_fetch_array($result)){$imageData= $row['content'];$imageType= $row['type'];header("content-type: $imageType");}echo $imageData;?>

Edited by arden
Link to comment
Share on other sites

help me with this code..i want to view my blob in a table..

<?php$con = mysql_connect("localhost","root","viewsonic");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("pix", $con);$result = mysql_query("SELECT * FROM upload");echo "<table border='1'><tr><th>Image</th></tr>";while($row = mysql_fetch_array($result)){$imageData= $row['content'];$imageType= $row['type'];header("content-type: $imageType");}	echo "<tr>";	echo "<td>" . $imageData . "</td>";	echo "</tr>";	echo "</table>";?>

Link to comment
Share on other sites

You can't have multiple content-types in one page (well, at least not really) - it is better to create a separate script that acts as the image.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...