image directory stored in mysql
Posted: Tue Dec 22, 2009 9:32 pm
Hi
I am trying to create an image gallery using the file directories for images that I have stored in a mysql database. I have other files of varying types also stored along with the images in the database. I could create a seperate image table but was wondering if their is a php method to only select images with image file extensions from the database.
I am trying to create an image gallery using the file directories for images that I have stored in a mysql database. I have other files of varying types also stored along with the images in the database. I could create a seperate image table but was wondering if their is a php method to only select images with image file extensions from the database.
Code: Select all
$query = "select corporate_details.corporate_details_id, corporate_details.corporate_details_title, corporate_details.corporate_details_file, file_type, file_size from corporate_details, published_details where corporate_details.corporate_details_id = published_details.corporate_details_id and
published_details.trainer_id = '$trainer_id' and corporate_details_title like '$files'";
$result = mysql_query($query) or die ("Error, query failed");
if(mysql_num_rows($result) ==0)
{
echo "Database is empty <br />";
}
else
{
while($row = mysql_fetch_array($result))
{
$mime_type= $row['file_type'];
$document_id = $row['corporate_details_id'];
$document_title = $row['corporate_details_title'];
$document_content = $row['corporate_details_file'];
$document_size = $row['file_size'];