sundeep Posted August 5, 2009 Share Posted August 5, 2009 hi, How to retrive image from mysql database using php and display retrived image in internet explorer directly Quote Link to comment https://forums.phpfreaks.com/topic/168947-how-to-retrive-image-from-mysql-and-dispaly-it-on-ie/ Share on other sites More sharing options...
Maq Posted August 5, 2009 Share Posted August 5, 2009 How is the image stored? Do you have anything done yet? Quote Link to comment https://forums.phpfreaks.com/topic/168947-how-to-retrive-image-from-mysql-and-dispaly-it-on-ie/#findComment-891368 Share on other sites More sharing options...
wildteen88 Posted August 5, 2009 Share Posted August 5, 2009 Well the basic query would be SELECT image_field_name FROM image_database_name You'd use mysql_query to run your query. Next you'll want to use mysql_fetch_array retrieve the results. You'll wan to use a while loop to loop through your results. Within your while loop you'll use something like echo '<img src="'.$row['image_field_name'].'">'; to dispaly your images Quote Link to comment https://forums.phpfreaks.com/topic/168947-how-to-retrive-image-from-mysql-and-dispaly-it-on-ie/#findComment-891370 Share on other sites More sharing options...
alexdemers Posted August 5, 2009 Share Posted August 5, 2009 Hey, if they are stored as BLOB (Binary), my best bet is to do a separate script (let's say get_image.php?id=xxx) and pass in the ID of the item: <?php echo '<img src="get_image.php?id='.$row['item_id'].'" />'; ?> And get_image.php will go get the image in the database according to the item ID passed in. This works pretty good in all browsers (maybe won't will very old one). Make sure to set the header accordingly: <?php header('Content-type: image/jpeg'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/168947-how-to-retrive-image-from-mysql-and-dispaly-it-on-ie/#findComment-891378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.