Problem could not show the image from a database $sql = "SELECT content FROM upload WHERE id=$id"; if(!($result=mysql_query($sql))) showerror; $data=mysql_fetch_array($result); echo'<img border=0 src='.$data['content'].' width=248 height=166>'; Code (markup):
$sql = "SELECT content FROM upload WHERE id=$id"; $result=mysql_query($sql); $data=mysql_fetch_array($result); if($data) echo'<img border=0 src='.$data['content'].' width=248 height=166>'; else showerror(); Code (markup):
You have a single quote problem in syntax use following code $sql = "SELECT content FROM upload WHERE id=$id"; if(!($result=mysql_query($sql))) showerror; $data=mysql_fetch_array($result); echo "<img border=0 src=".$data['content']." width=248 height=166>"; PHP:
result: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\myscripts\uploads\view.php on line 15 Fatal error: Call to undefined function showerror() in D:\AppServ\www\myscripts\uploads\view.php on line 19
$sql = "SELECT content FROM upload WHERE id=$id"; if(!($result=mysql_query($sql))) showerror; $data=mysql_query($result); echo "<img border=0 src=".$data['content']." width=248 height=166>"; Code (markup): not error but no view picture!
$sql = "SELECT content FROM upload WHERE id=$id"; if(!($result=mysql_query($sql))) showerror; $data=mysql_fetch_assoc($result); echo '<img border="0" src="'.$data['content'].'" width="248" height="166">'; PHP:
print data no image «¾ئئئزززتتت–¢¯\m}ÙÙٌؤؤؤ„™©¨ش‎PMJٌîéذذذ“’’êىîx½â€Â¯Â¯Â¯Â¢Â£Â£Ø¬Ø¬Ø¬ Z…؛e~•o¬î‎ْÙSSS™±عi§îنمâûّْ‚‚‚£»م¢،ں¤¤¤»»»KJJ*¸هزذد×ظعFNXكغضصصصOe{861ôÙٌëëيçههGEB؟هے?²ےجےكÙےïùےمممًًًىىىهههںےà à à O¹ےدىےيييêêê¥ےâââëëëççç™ےüüüèèè÷÷÷نننééé/¬ے¸¸¸_ØŸÛ’ÙÙÙوووٌٌٌoØ¥Û’â€â€â€Ù„للںظےڈزے‎‎‎¯كےةةةÙÙ÷ذشطًًٌ‎ü‎ًٌٌü‎ün¯ّe“؟]کهييپ_‹¾Vi‚dddmjhUٹ½z´ٌ7¯¬D€°ôc <د جS‡çÛ@Ù¾ ¦5™‰پ L0"W#BØ·V Hھôا€™¥:ض±ˆ%پˆ0²مشڈ?‰ٌ2يً©‹KPTI+’گّمÛÙ‚{y00<#D‰ے9؛ôرپژظ†ôڈشw¨كے†ْ*Ù†$Û’Ú¯