How would you select multple rows with in a MySQL database where the data type is longblob? I have pictures stored in those, and I want to select the multiple rows under a certain condition.
I have an additional column -- called "UserName" -- that goes along with each longblob column named "Image."
Let's say I have some rows with the UserName of John. How would I select all rows with the UserName John, and echo all of those images stored with in the second column of "Image."
This is the code I have, but it doesn't work.
<?php
include "db_connect.php";
$sql = 'SELECT * FROM `photoalbum` LIMIT 0, 30 ';
$result = mysql_query($sql);
while ($row=mysql_fetch_array($result))
{
$username=$row["UserName"];
}
$result=mysql_query("SELECT * FROM photoalbum WHERE UserName=$username") or die("Sorry $username, but I can't perform your query.");
$row=mysql_fetch_object($result);
Header( "Content-type: image/jpg");
echo $row->Image;
?>