Announcement

Collapse
No announcement yet.

Need to display pictures stored in database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to display pictures stored in database

    I want that visitors to my website be able to upload their own pictures and later display them. While the uploading part seem to work, as the database is getting populated, I am unable to display the pictures. I am using pictures in the jpg format. The code that I am using is:

    <?php
    session_start();
    $userId = $_SESSION['userId'];
    $password = $_SESSION['password'];
    $db_host= "localhost";
    $db_user = "XXXX_YYYY";
    $db_password = "AAAAA";
    $db_name ="XXXX_StudyKitchenData";
    $db = mysql_connect($db_host, $db_user, $db_password);
    mysql_select_db($db_name, $db);
    $sql = "SELECT Email FROM UserDetails WHERE Email = '$userId' AND Password = '$password'";
    $result = mysql_query($sql, $db);
    if(!mysql_num_rows($result)== 1){
    unset($_SESSION['userId'], $_SESSION['password']); // clear bad username/password from session;
    header("location:http://www.studykitchen.com/login.php"); // redirect for them to login again
    }
    $query = "SELECT Picture FROM mypic WHERE Email ='$userId'";
    $result = mysql_query($query, $db);
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
    //I need code for this part

    }
    mysql_close($db);
    ?>

    Any help will be highly appreciated.

  • #2
    Re: Need to display pictures stored in database

    thank yuo

    Comment

    Working...
    X