Jump to content

Including an image within PHP


maxihobbs

Recommended Posts

I'm trying to call each user's uploaded images from a database into my site for others to view.

 

I currently have their personal information such as name and email which have been called from a MYSQL database, but I have no idea how to call each users separate images?

 

Any ideas at all. My code for the page is here:

 

<?php

 

mysql_connect("localhost", "root", "") or die(mysql_error());

mysql_select_db("robinstalk") or die(mysql_error());

 

if (isset($_GET['member'])) {

    // connect to database.

    $sql = "SELECT * FROM users WHERE first = '{$_GET['member']}'";

    $result = mysql_query($sql);

    if ($result) {

      if (mysql_num_rows($result) > 0) {

        $row = mysql_fetch_assoc($result);

        echo "<br />

  <br />

  First Name : {$row['first']}

      <br />

  <br />

  Last Name : {$row['last']}

  <br />

  <br />

  Email : {$row['email']}

  <br />

  <br />

  About : {$row['about']}

  <br />

  <br />

  Pictures: THIS IS WHERE IM STUCK AT WHAT TO PUT

  ";

 

      } }

  }

?>

 

Link to comment
https://forums.phpfreaks.com/topic/194683-including-an-image-within-php/
Share on other sites

You can store the images in two ways

 

#1 - As the path to your image on your webserver (highly recommend this)

#2 - As binary data in your database. (highly do not recommend this)

 

If you're doing it as #1 - you would do as the poster above said :) 

 

If you're doing #2 you should be beat with a hose filled with sand.

 

Good luck!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.