Jump to content

how to view... in a table


arden

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;?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...