i have two select statement in one query in loadimage.php fle and display it in two different procees, one image for the event and one image for news. my code goes like this
loadimage.php
<?php
mysql_connect("localhost","root");
mysql_select_db("pcnl");
$q="select * from tbl_event where event_ID = ".$_GET['id'];
$rec=mysql_fetch_array(mysql_query($q));
$image=$rec['event_img'];
header('Content-Length: '.strlen($image));
header("Content-type: image/".$rec['event_imgExt']);
echo $image;
$sqlmain="select * from tbl_news where news_ID = ".$_GET['mainid'];
$mainimg=mysql_fetch_array(mysql_query($sqlmain));
$mainimage=$mainimg['news_img'];
header('Content-Length: '.strlen($mainimage));
header("Content-type: image/".$mainimg['news_ext']);
echo $mainimage;
?>
event.php
<img src="loadimage.php?id=<?php echo $events[id];?>" width="700px" height="350px">
news.php
<img src="loadimage.php?mainid=<?php echo $main['news_ID'];?>" width="300px" height="350px">