binukjames
06-26-2008, 11:18 AM
I'm developing a wap site using wml and php.
my php code is retrievig and displaying blob image from database.
but i cannot include any wml part to this page.
actually i want to display image from database with some links.
is it possible ?give me any sample code... plz help me....
my code is.......
<?php
function db_connect($user='root', $password='admin', $db='example')
{
mysql_connect('localhost', $user, $password) or die('I cannot connect to db: ' . mysql_error());
mysql_select_db('example');
}
// echo "hellow world";
db_connect();
$sql = "select imgdata from pix where title=1";
$result = mysql_query("$sql");
while($row = mysql_fetch_array($result))
{
$bytes = $row['imgdata'];
}
header("Content-type: image/jpeg");
print $bytes;
exit ();
mysql_close();
?>
--------------------------------------------------------------------------
OUTPUT : DISPLAYING IMAGE
--------------------------------------------------------------------------
BUT IF I REMOVE COMMENT FOR echo "hellow world"; THE OUTPUT WILL B LIKE THIS
-------------------------------------------------------------------------
hellow world
Warning: Cannot modify header information - headers already sent by
(output started at C:\web\htdocs\show\image.php:7) in C:\web\htdocs\show\image.php on line 15
ÿØÿàJFIF``ÿá ExifMM*bj(1r2އi¤Ð¦'
H¼—«ÿ?îÛ„ætºDûiÇ?cùÛòÿæöý:+¡tÿ㇦fäâàg³
\,3cr]¸Cq¥”XæÍs‡¥½y?8"¼ŠÝ‘Sí ¶¶;Ó{›ûµØæX
Ö_b»ÊáÇ(ÈqK÷ul?ΦWÖÿ¯ »ì¹K.»Ûþ è;_st?ß¹Cþ
}}s«ôNê™ ö?í¥ÀŽÏÞÍû¿¬»^…õ÷¢tþ†jvŒê-ž—M¦û
öÜÇ?»*Íôªô½;ôôú¡Æôý/WùµV¼ÿñ]Ôžoê}2ì<ÜÇ9ÙV9×=
•Úùu–}¢«6mßþÑÿ±=Ĺ}"kÒ?«»þ+:ÿXëXÎê™NÊv=¬eNsZk
š\Ặ³»÷×rõOêÿB蘹tL‡dbæ<[½Ö6Ö ¢éYPú]ùë3ëøÆ¯
¤õ+:nêc†œ§›EU³{[§†\ë\æ»ôžÖzj©?¹’^Üt&Àð]°ÕíS@XÿVz
ïí®??Ô.kqîÈu£ìáû‹EvÛC¬=îÙW»Ú´îÊÇ }¬¨;F—¸6cÃqQ?A ?B
S$¨³ô{æWŸŒ÷3W5·VHÊÕ²ö
¸˜2x?ILÒUêÎùÛ)¾»\âö¸ÇïCJ][¥Ý?1©Ì¢Ì‡[K ....
my php code is retrievig and displaying blob image from database.
but i cannot include any wml part to this page.
actually i want to display image from database with some links.
is it possible ?give me any sample code... plz help me....
my code is.......
<?php
function db_connect($user='root', $password='admin', $db='example')
{
mysql_connect('localhost', $user, $password) or die('I cannot connect to db: ' . mysql_error());
mysql_select_db('example');
}
// echo "hellow world";
db_connect();
$sql = "select imgdata from pix where title=1";
$result = mysql_query("$sql");
while($row = mysql_fetch_array($result))
{
$bytes = $row['imgdata'];
}
header("Content-type: image/jpeg");
print $bytes;
exit ();
mysql_close();
?>
--------------------------------------------------------------------------
OUTPUT : DISPLAYING IMAGE
--------------------------------------------------------------------------
BUT IF I REMOVE COMMENT FOR echo "hellow world"; THE OUTPUT WILL B LIKE THIS
-------------------------------------------------------------------------
hellow world
Warning: Cannot modify header information - headers already sent by
(output started at C:\web\htdocs\show\image.php:7) in C:\web\htdocs\show\image.php on line 15
ÿØÿàJFIF``ÿá ExifMM*bj(1r2އi¤Ð¦'
H¼—«ÿ?îÛ„ætºDûiÇ?cùÛòÿæöý:+¡tÿ㇦fäâàg³
\,3cr]¸Cq¥”XæÍs‡¥½y?8"¼ŠÝ‘Sí ¶¶;Ó{›ûµØæX
Ö_b»ÊáÇ(ÈqK÷ul?ΦWÖÿ¯ »ì¹K.»Ûþ è;_st?ß¹Cþ
}}s«ôNê™ ö?í¥ÀŽÏÞÍû¿¬»^…õ÷¢tþ†jvŒê-ž—M¦û
öÜÇ?»*Íôªô½;ôôú¡Æôý/WùµV¼ÿñ]Ôžoê}2ì<ÜÇ9ÙV9×=
•Úùu–}¢«6mßþÑÿ±=Ĺ}"kÒ?«»þ+:ÿXëXÎê™NÊv=¬eNsZk
š\Ặ³»÷×rõOêÿB蘹tL‡dbæ<[½Ö6Ö ¢éYPú]ùë3ëøÆ¯
¤õ+:nêc†œ§›EU³{[§†\ë\æ»ôžÖzj©?¹’^Üt&Àð]°ÕíS@XÿVz
ïí®??Ô.kqîÈu£ìáû‹EvÛC¬=îÙW»Ú´îÊÇ }¬¨;F—¸6cÃqQ?A ?B
S$¨³ô{æWŸŒ÷3W5·VHÊÕ²ö
¸˜2x?ILÒUêÎùÛ)¾»\âö¸ÇïCJ][¥Ý?1©Ì¢Ì‡[K ....