treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Need a Point in the Right Direction.

  • I just got finished putting together the photo gallery "#64: Building a Photo Gallery" from this site and everything works fine. Now I'm trying to incorporate it into my design but I have no idea where to start. I'm a novice with css but I understand it and I'm trying to learn php via online tutorials.

    I'm wondering if I just need to copy and paste part of the php file into my html document inside of a div tag. I tried pasting all the php but that didn't work. Is their a better way of doing this or a certain part of the php document I need to paste in?

    Here is the test gallery.
    http://www.shepardsuperteam.com/chris/index.php

    Here is where I need it.
    http://shepardsuperteam.com/chris/gallery.html

    And this was the tutorial of the gallery.
    http://css-tricks.com/video-screencasts ... o-gallery/

    Any help would be gratefully appreciated.
    Thanks!
  • I would personally make a mysql database with the following fields: name, description, thumbnail_url, and fullsize_url; and then use something like like this to display the photos:


    $conn = mysql_connect('localhost, 'username', 'password') or die ('Error');
    mysql_select_db('name');

    $sql = \"SELECT * FROM dbname\";
    $result = mysql_query($sql);

    echo '<table align=center cellspacing=\"2\" rules=\"rows\" frame=\"box\">
    <colgroup>
    <col width=\"90\">
    <col width=\"500\">
    </colgroup>';


    while($row = mysql_fetch_assoc($result)){

    $name=$row['name'];
    $src=$row['thumbnail_url'];
    $src_full=$row['fullsize_url'];

    echo '
    <center>
    <tr>
    <td><center><img src='.$src.'></center></td>
    <td><center><a href='.$src_full.'>'.$name.'</a></center></td>
    </tr>
    ';}
    </table>