Thank you all. The code displayed below works.
@: I used mysql_result. I could not find out how to use mysql_fetch() ( denotes array, assoc, field, lengths, object, row)
Can any one suggest how to use mysql_fetch*() instead of mysql_result. It is not required though but might be useful for some one else.
<?php
$link=mysql_connect("localhost","root","");
if(!$link)
{
die("could not connect:".mysql_error());
}
mysql_select_db("media",$link);
$que="select imageBlob from images where imageId=21";
$ret=mysql_query($que)or die("Invalid query: " . mysql_error());
$returned=mysql_result($ret,0,0);
$file=fopen("downloadedImage.jpeg","w");
fwrite($file,$returned);
?>