How to get retrieve an image from a mysql database and echo it out in php?
How can I get an Image from a mysql database and echo it to the screen??
I have this script to get the information from the database:
/* check connection */
if (mysqli_connect_errno()) {
echo("Connection Error: ". mysqli_connect_error());
} else {
$query = "SELECT * FROM games";
if ($result = mysqli_query($link, $query)) {
/* fetch associative array */
$row = mysqli_fetch_assoc($result);
}
}
but when I try to echo the image to the screen I get this:
ï öËgt;Ti¥òŦ„u`¨c'–÷½µÏÿøå[Kuu&lsqauo;].YW\Æ3dŒä
Ã|ÊÐkµa_êøÊwþ"c~n•…æjoÈÔ^r¸dbt~8Ø|•33ID
ꨣVcamp;"Ñ£H¡::Ó_/þ8Àuæ£-¶edWHÂ5Þ'Lf:ägt;œv*Jk¬±È([å´³*«qÀÓŸuÀ%$š—¹Õf^¾Ä
¯ªøú«[öÐó_ZNDpÀºì²[ÄYï,&lsqauo;–¼i©C/Ðê¨È‡Oôò–£FÕ–h£QúÖq+¥Qƒ¹Á0E˜¾°Ym©¬XPd'oYDe¼…ţϳÐâ!íwúX
°mÍú¨?n݆^®mí:‡Â5ðàFlt;è¼R"œíZñœ&lsqauo;Ö6«'-0ŠyØÐ*ròw¼lt;ñ$³ÿC[Ë¡§^[ßZQƒFÔ D h!
\³Hï[À¬Ú´kÔ=Šaè\«Ïþ+«®Ñ…3ú‰Ç'WõÛbŒ‚liƒ°ØjãŒ6ÚF ÇvÛÿ ÎÖ(PÇQ÷ç
ÃVTh:cS÷Ä8Š9ïµ´¶§*®åËÍ:äü°Ø"£Ãs"×VÖûÄ£ùZ'xúòuCh:y?ªÈéh¶ƒšjû£
/code/pre
pexcept much longer./p
pHow can I echo the image??/p
pThanks./p