DWP Posted December 20, 2006 Share Posted December 20, 2006 [code]<?php$result=mysql_query("SELECT * FROM profiles");while($M = mysql_fetch_array($result)){//if ($M[img] !== "") { header("Content-type: image/jpeg"); echo "$M[img]"; exit (); }echo "<table> <tr> <td colspan=\"2\"> {$M[Nick]} </td> </tr> <tr valign=\"top\"> <td><table border=\"0\"> <tr> <td><img src=\"{$M[img]}\" width=\"130\" height=\"170\" alt=\"\" /></td> </tr> </table></td> <td><table width=\"100%\" border=\"0\"> <tr> <td>Name: {$M['First']} {$M['Last']} </td> </tr> <tr> <td>Age: {$M['Age']} </td> </tr> <tr> <td>Sex: {$M['Sex']} </td> </tr> <tr> <td>Location: {$M['Location']} </td> </tr> </table></td> </tr></table>"; }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31347-problem-with-outputting-image-from-blob/ Share on other sites More sharing options...
phpPunk Posted December 24, 2006 Share Posted December 24, 2006 For starters, you trying to use an array inside a string like a scalar...they don't use quite the same syntax for interpolation...[code]echo "$M[img]";[/code]Should be[code]echo $M['img'];[/code]Notice you don't need the double quotes around the whole thing...but you do need quotes inside the square brackets to properly index an associative field...If you have some reason where you absolutely need the array inside a string and wish to use interpolation still...I believe the syntax is...[code]echo "${M['img']}";[/code]Again...you still need quotes around the associative index but you also need curly brackets...Cheers :) Quote Link to comment https://forums.phpfreaks.com/topic/31347-problem-with-outputting-image-from-blob/#findComment-147382 Share on other sites More sharing options...
DWP Posted December 25, 2006 Author Share Posted December 25, 2006 updated code but it only shows pic not the rest?[code]<?php$result=mysql_query("SELECT * FROM profiles");while($M = mysql_fetch_array($result)){if ($M['img'] !== "") { header("Content-type: image/jpeg"); echo $M['img']; exit (); } else { echo "No Image"; }echo "<table> <tr> <td colspan=\"2\"> {$M[Nick]} </td> </tr> <tr valign=\"top\"> <td><table border=\"0\"> <tr> <td><img src=\"{$M['img']}\" width=\"130\" height=\"170\" alt=\"\" /></td> </tr> </table></td> <td><table width=\"100%\" border=\"0\"> <tr> <td>Name: {$M['First']} {$M['Last']} </td> </tr> <tr> <td>Age: {$M['Age']} </td> </tr> <tr> <td>Sex: {$M['Sex']} </td> </tr> <tr> <td>Location: {$M['Location']} </td> </tr> </table></td> </tr></table>"; }?>[/code]thats what it shows [url=http://www.pwdinc.ca/PWD/mem.php]www.pwdinc.ca/PWD/mem.php[/url] dose put the rest of the info in Quote Link to comment https://forums.phpfreaks.com/topic/31347-problem-with-outputting-image-from-blob/#findComment-147443 Share on other sites More sharing options...
DWP Posted January 5, 2007 Author Share Posted January 5, 2007 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/31347-problem-with-outputting-image-from-blob/#findComment-153452 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.