Show users uploaded profile pic using PHP
<p>I have a website in which user upload their profile picture and I have stored the pic in a folder and their links are reflected in Database 
How do i show that link in the place where i have to show the photo ?</p>

<p>Code for uploading photo</p>

<pre><code>    define ("MAX_SIZE","1000"); 
    function getExtension($str)
    {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
    }

    $errors=0;
    $image=$_FILES['image']['name'];

    if ($image) 
    {

$filename = stripslashes($_FILES['image']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") &amp;&amp; ($extension != "jpeg") &amp;&amp; ($extension != "png") 
    &amp;&amp; ($extension != "gif")&amp;&amp; ($extension != "JPG") &amp;&amp; ($extension != "JPEG") 
    &amp;&amp; ($extension != "PNG") &amp;&amp; ($extension != "GIF")) 
{
    echo '&lt;h3&gt;Unknown extension!&lt;/h3&gt;';
    $errors=1;
}
else
{
    $size=filesize($_FILES['image']['tmp_name']);

    if ($size &gt; MAX_SIZE*1024)
    {
        echo '&lt;h4&gt;You have exceeded the size limit!&lt;/h4&gt;';
        $errors=1;
    }

    $image_name=time().'.'.$extension;
    $newname="photo/".$image_name;

    $copied = copy($_FILES['image']['tmp_name'], $newname);
    if (!$copied) 
    {
        echo '&lt;h3&gt;Copy unsuccessfull!&lt;/h3&gt;';
        $errors=1;
    }
    else echo '&lt;h3&gt;uploaded successfull!&lt;/h3&gt;';

    //mysql_query("insert into tutor (photo) values('".$newname."')");
    $myphoto= ".$newname.";
}
</code></pre>

<p>Code for insertion</p>

<pre><code>    $mysqli = new mysqli("localhost", "***", "***", "***");
    if ($mysqli-&gt;connect_errno) {
        echo "Failed to connect to MySQL: (" . $mysqli-&gt;connect_errno . ") " .                         $mysqli-&gt;connect_error;
    }

    /* Prepared statement, stage 1: prepare */
    if (!($stmt = $mysqli-&gt;prepare("INSERT INTO `table` (`photo` ) VALUES (  ?)"))) {
        echo "Prepare failed: (" . $mysqli-&gt;errno . ") " . $mysqli-&gt;error;
    }

    /* Prepared statement, stage 2: bind and execute */

    if (!$stmt-&gt;bind_param('s',$myphoto )) {
        echo "Binding parameters failed: (" . $stmt-&gt;errno . ") " . $stmt-&gt;error;
    }

    if (!$stmt-&gt;execute()) {
        echo "Execute failed: (" . $stmt-&gt;errno . ") " . $stmt-&gt;error;
    }
</code></pre>
