justcraig Posted January 22, 2007 Share Posted January 22, 2007 Im a beginner not completely useless but entirely self taught via trial and error. I am having an issue i am building a website at the moment and i have the news article table. In the table i have 5 rows of longblob binary image data. Now i get 1 of the five rows to display but the rest give me headers already sent errors. i was wondering if somebody more skilled then me could help me figure out what im doing wrong.Code below:<?php require_once('../Connections/gyfinal.php'); ?><?php$colname_articles = "-1";if (isset($_GET['article_id'])) { $colname_articles = (get_magic_quotes_gpc()) ? $_GET['article_id'] : addslashes($_GET['article_id']);}mysql_select_db($database_gyfinal, $gyfinal);$query_articles = sprintf("SELECT image1, image2, image3, image4, image5 FROM news_article WHERE id = %s", $colname_articles);$articles = mysql_query($query_articles, $gyfinal) or die(mysql_error());$row_articles = mysql_fetch_assoc($articles);$totalRows_articles = mysql_num_rows($articles);header("Content-type: image/jpeg") ;echo $row_articles['image1']; echo $row_articles['image2'];echo $row_articles['image3'];echo $row_articles['image4'];echo $row_articles['image5'];mysql_free_result($articles);?>This displays the first image (image1) perfectly but the rest give me an error that the headers have been sent already.Any help would be appreciated.If you need any more info please reply with what you need Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/ Share on other sites More sharing options...
fert Posted January 22, 2007 Share Posted January 22, 2007 You can't display multiple images at once like that Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-165990 Share on other sites More sharing options...
justcraig Posted January 22, 2007 Author Share Posted January 22, 2007 how would you do it? im kinda new to images in mysql would be grateful for your help Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-165997 Share on other sites More sharing options...
fert Posted January 22, 2007 Share Posted January 22, 2007 you would have to display the images on separate pages Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-166004 Share on other sites More sharing options...
pocobueno1388 Posted January 22, 2007 Share Posted January 22, 2007 Could you give an example of a value $row_articles['image1'] would hold? Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-166006 Share on other sites More sharing options...
fert Posted January 22, 2007 Share Posted January 22, 2007 probably something like this[code]‰PNG[/code] Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-166007 Share on other sites More sharing options...
justcraig Posted January 22, 2007 Author Share Posted January 22, 2007 it holds the image that has been converted to binary data.I can get the the image into binary i just cant get it out of binary Link to comment https://forums.phpfreaks.com/topic/35153-displaying-images-from-mysql/#findComment-166013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.