Closed Thread
Page 6 of 22 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 214

Thread: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

  1. #51
    nizzu is offline Newbie
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Smile Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Thank you nice tutorial well done !

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #52
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    you're welcome

  4. #53
    Ablaze is offline Newbie
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Hello,

    thanks for you help...:-)
    u rock!

    i have a prob wit the while stm, bin tryin to display all da images in da DB table.
    bt i only get one back.

    thanks

  5. #54
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Yes.. with this script you only can display one picture.. You need to edit this script a little if you want to see many pictures..

  6. #55
    Ablaze is offline Newbie
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    hi,

    thanks for the reply...
    im still having probs with displaying all images in the DB...
    and how can i show the title and img .........all at one place from the item table(where the images are)

    pls take a look at my code below.
    it goes thru the loop and displays only the first image the exact number of the images in the DB.
    Code:
    <?php

    /////////imgView.php//////

    header('Content-type: image/jpeg'); // act as a jpeg file
        
    mysql_connect('localhost','user1','testing')or die(mysql_error());
        
    mysql_select_db('ebayr')or die(mysql_error()); // use the ‘test’ database

        
    $query 'select * from item';
        
    $result mysql_db_query('ebayr',$query)or die(mysql_error());

        
    $row mysql_fetch_array($result);
        
    $img $row['Picture'];
        
    $title $row['itemName'];

        echo (
    $title); 
        echo (
    $img);
        
         
         
    ?>
    Code:
    <?php

    ///////disAllImages.php////////

    $username "user1";
    $password "testing";
    $host "localhost";
    $database "ebayr";

    mysql_connect($host$username$password) or die("Can not connect to database: ".mysql_error());

    mysql_select_db($database) or die("Can not select the database: ".mysql_error());

    $query mysql_query("SELECT * FROM item")or die("Cannot exe----- select the database: ".mysql_error());
    while(
    $row mysql_fetch_array($query)){
       
    $title $row['itemName'];

        echo (
    $title); 
        
        echo 
    "<img src='imgView.php' width=144><br><br>";
        
    //echo = $row["Picture"];

    }  


    ?>
    Thanks......
    Last edited by Jaan; 03-01-2009 at 01:58 PM. Reason: Please use code tags when you're posting your codes!

  7. #56
    ikurniawan is offline Newbie
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    cool

  8. #57
    Ablaze is offline Newbie
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Smile Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    hello...
    pls i still need help on the above problem...
    still trying to display all the imges in the DB.

    pls take a look at my code above...

    thanks

  9. #58
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Hmm.. I really don't know is it even possible to display all your images via one file..

  10. #59
    deenic is offline Newbie
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    hi i am trying to get this tutorial to work with mysqli

    here is my code, it works fine in firefox but not in safari. any idea's why?
    Code:
        else
        {
        
    $query "SELECT * FROM `binary` WHERE `id`='".$id."'";
        
        
    $result mysqli_query($cxn$query) or die("Invalid query: " mysql_error());
        
    $rowmysqli_fetch_assoc($result);
        
    $content $row['image_name'];
        
        
    header('Content-type: image/jpg');
        echo 
    $content;
        } 
    Last edited by John; 04-08-2009 at 08:11 AM.

  11. #60
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Dear Sir,

    Many thanks for post the value tutorials in here i really appreciated. but after that i try your code(showimage.php?id=1) it is alway give me download file showimage.php.

    My needed could you write me a new tutorial that show all image that i was input to database in the table?

    special thanks for reply and spend your valuable time to code for me and other one that need.

    Please have a look at my code
    Code:
    <?
    include ("includes/config.php");
    include (
    "includes/function.php");
    header('Content-type: image/jpeg');
    $query "SELECT id,imagename,image,description FROM gallery";
    $result mysql_query($query) or die('Error, query failed');
    if ( 
    mysql_num_rows($result) == 0)
    {
        echo 
    "Database is empty<br>";
    }
    else
    {
        while ( 
    $row mysql_fetch_array($result))
        {
            
    $id $row['id'];
            
    $imagename $row['imagename'];
            
    $image $row['image'];
            
    $description $row['description'];

    ?>

        <table border="1">
        <tr>
            <td><? echo $id?></td>
            <td><img src="showimage.php?id=<?=$id;?>" width="144" height="165" /></td>
            <td><? echo $imagename?></td>
            <td><? echo $description;?></td>
        </tr>
        
        
    <?
        
    }
    }
    ?>
    Regards,

    Steven.
    Last edited by steven_elvisda; 04-08-2009 at 02:35 AM.

Closed Thread
Page 6 of 22 FirstFirst ... 4567816 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 4 users browsing this thread. (0 members and 4 guests)

Similar Threads

  1. Replies: 3
    Last Post: 02-07-2011, 11:29 AM
  2. Tutorial: Storing Images in MySQL with PHP
    By Jordan in forum PHP Tutorials
    Replies: 47
    Last Post: 01-04-2011, 08:37 PM
  3. Beginner Storing images in XML file - Part II - Displaying image
    By Jaan in forum PHP Tutorials
    Replies: 6
    Last Post: 01-04-2011, 08:35 PM
  4. display images sequentially using PHP and MySQL
    By jhanjon in forum PHP Development
    Replies: 2
    Last Post: 10-08-2009, 12:11 PM
  5. Replies: 2
    Last Post: 07-16-2009, 12:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts