how to insert picture and show multiple picture

I want to insert picture mysql database through php and want to show m

Page 1 of 1

6 Replies - 9608 Views - Last Post: 14 January 2009 - 09:59 AM Rate Topic: -----

#1 abir_ju  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-January 09

how to insert picture and show multiple picture

Post icon  Posted 10 January 2009 - 10:41 AM

For a longtime i try to findout the code of inserted picture and show multiple pictue from mysql via php. Is there anybody who help me to insert and show multiple picture php/mysql
Is This A Good Question/Topic? 0
  • +

Replies To: how to insert picture and show multiple picture

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: how to insert picture and show multiple picture

Posted 10 January 2009 - 10:55 AM

You don't want to insert the picture DIRECTLY into the database for many reasons. It slows down retrieval of records, they are clumsy to work with, they bloat the database size and they don't make the links to those graphics searchable.

What you will want to do is allow PHP to upload the file to a folder and then store the path to that file in the database.

By doing it this way you keep the database size low, the text you enter for the path can be searchable (like you can do a search on the files name through the database) and they are easier to retrieve using a select statement or easier to update using an update method.

When you retrieve the records you will then retrieve the path which you can directly stick into an <img> tag for display. I advise you set it up like this because the pros greatly outweigh the cons in this situation.

Good luck to you.

:)
Was This Post Helpful? 0
  • +
  • -

#3 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: how to insert picture and show multiple picture

Posted 10 January 2009 - 04:45 PM

What you do when you have the links of the images in the database is you can then do a query and get them from there. You then can do a while statement that will show them all.
Was This Post Helpful? 0
  • +
  • -

#4 genesis1989  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 16
  • Joined: 30-December 08

Re: how to insert picture and show multiple picture

Posted 13 January 2009 - 06:09 PM

View Postabir_ju, on 10 Jan, 2009 - 09:41 AM, said:

For a longtime i try to findout the code of inserted picture and show multiple pictue from mysql via php. Is there anybody who help me to insert and show multiple picture php/mysql


I wont argue with a mentor but i think i could help u out with inseting images into a database... but as far as multiple retrival goes ... i can only retrive 1 image at a time . Make sure the database table which stores teh image is kept as a "blob". the following codes will help u to retrive the images.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#5 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: how to insert picture and show multiple picture

Posted 14 January 2009 - 12:42 AM

Having a look at your code thats good. I tend to keep that all together on my gallery. You seem to use print a lot fi I remember right echo works a lot faster it might be good to use when showing images.
Was This Post Helpful? 0
  • +
  • -

#6 genesis1989  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 16
  • Joined: 30-December 08

Re: how to insert picture and show multiple picture

Posted 14 January 2009 - 12:45 AM

View Postsam_benne, on 13 Jan, 2009 - 11:42 PM, said:

Having a look at your code thats good. I tend to keep that all together on my gallery. You seem to use print a lot fi I remember right echo works a lot faster it might be good to use when showing images.


Oh were u refering to me, sam? if so thanx for the tip on echo and print! :)
Was This Post Helpful? 0
  • +
  • -

#7 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: how to insert picture and show multiple picture

Posted 14 January 2009 - 09:59 AM

Yes I was, hope it helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1