Jump to content

Recommended Posts

[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\">&nbsp;&nbsp; {$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]
Link to comment
https://forums.phpfreaks.com/topic/31347-problem-with-outputting-image-from-blob/
Share on other sites

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 :)
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\">&nbsp;&nbsp; {$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
  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.