which is best for me to use a gallery or database

Discussion in 'PHP' started by dougvcd, Jul 9, 2007.

  1. #1
    ok if you have the time to view my site
    which is better for me to use a gallery or database
    at the moment all info is on database and images stored on server
    which allows peeps to enter right away except photo
    but if i use a gallery i have to enter the info which i dont mind
    i would like the details to be beside the photo and not underneath as they are at the moment
    this is the code i have

    //Retrieves data from MySQL 
    $data = mysql_query("SELECT * FROM members WHERE region='exchange' or region='both'") or die(mysql_error()); 
    //Puts it into an array 
    while($info = mysql_fetch_array( $data )) 
    { 
    
    //Outputs the image and other data
    Echo "<img src=http://www.caravan-holiday-exchange.com/images/".$info['pname'] ."> <br>";
    Echo "<b>Park Name:</b> ".$info['parkname'] . " <br>";
    Echo "<b>Park Location:</b> ".$info['parklocation'] . " <br>";
    Echo "<b>Details:</b> ".$info['caravandetails'] . " <hr>";
    PHP:
    cheers
    Doug
     
    dougvcd, Jul 9, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    I'm afraid your gallery is database driven, lol.

    I'm really really confused by your question. Doesn't your current code do what you want?
     
    nico_swd, Jul 9, 2007 IP
  3. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok at the moment my gallery is database driven
    what i was asking is this better than having a gallery which i enter info manually
    is one better than the other as regards performance
    cheers
    Doug
     
    dougvcd, Jul 10, 2007 IP
  4. Doskono

    Doskono Peon

    Messages:
    153
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Mistake me if I'm wrong but are you comparing making a gallery with php and mysql or basic html updates.

    Well I wouldn't compare these two languages because one is necessarily faster than the other. Although you will have less errors if you go with html. Although if you code well in php and mysql you will have a very easy update way to add things to this gallery where html can become a pain in the butt to update every now and then.
     
    Doskono, Jul 10, 2007 IP
  5. Cloudberries

    Cloudberries Peon

    Messages:
    74
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Agreed :)

    Doug: Are you asking if there's any benefit in getting rid of the database and just writing the HTML pages yourself? i.e. hand coding in all the information to display the images?

    Performance issues are pretty much non-existent with small-scale databases. I could have a database containing 10,000 different items, and you'd be able to code a page that would retrieve that info almost as fast as if it were just written in by hand.

    In pretty much any circumstance, a database driven gallery is the best option - it allows you to easily maintain everything, gives everything a clean, consistent layout and means it's very simple to add images (rather than adding each thing in by hand)

    To change the layout of your images just requires re-jigging the code you posted in post #1 to give a different HTML layout - perhaps put each image and text in differnt table cells, one next to the other?
     
    Cloudberries, Jul 10, 2007 IP
  6. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thank you for all replies will stick with what i have at the moment
    the only thing i dont know how to do is alter the code so the description is next to the photo and not underneath as it is at the moment seems to waste space
    if any one can oblidge
    cheers
    Doug
     
    dougvcd, Jul 10, 2007 IP