MySQL
  Home arrow MySQL arrow Page 2 - Online Photo Album Development using P...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Online Photo Album Development using PHP and GD: Part 2
By: Frank Manno
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 31
    2004-04-22

    Table of Contents:
  • Online Photo Album Development using PHP and GD: Part 2
  • Code: Explained
  • Configurating
  • Connecting to the Database
  • 1,2,3, Testing

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Online Photo Album Development using PHP and GD: Part 2 - Code: Explained


    (Page 2 of 5 )

    The HTML code is straight-forward; however, I'll explain the PHP code from above:

    include("../include/config.php");
    ?>

    We'll be including config.php in all of our files. The config.php file allows us to make use of global variables throughout our application. Our config.php file looks like this:

     
    <p><!--p<-->// Include file for database connectivity 
    <br />$db_server "localhost"
    <
    br />$db_user "admin"
    <
    br />$db_pass "admin"
    <
    br />$db_name "album"
    <
    br />// Number of images to display per row in gallery view 
    <br />DEFINE("IMAGE_DISPLAY"3); 
    <
    br />/***** 
    <br />* Connects to database system 
    <br />*/ 
    <br />function db_connect(){ 
    <
    br />global $db_server
    <
    br />global $db_user
    <
    br />global $db_pass
    <
    br />global $db_name
    <
    br />$dbcnx mysql_connect($db_server$db_user$db_pass) or die("Error connecting 
    to database: " 
    mysql_error()); 
    <
    br />$dbsel mysql_select_db($db_name$dbcnx) or die("Error reading from database 
    table: " 
    mysql_error()); 
    <
    br />} 
    <
    br />/***** 
    <br />* Displays HTML output page. The message argument, if passed, 
    <br />* will be displayed to the user. The title element, is passed, 
    <br />* replaces the page title, and the cell Boolean places the page 
    <br />* $msg between 
    <td />
    </td />
    <br />*/ 
    <br />function displayPage($msg ""$title=""$cell true){ 
    <
    br />

     
    <br />
    <br />
    <br />
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <br />
    <tbody>
    <tr>
    <br />
    <td>
    <br />
    <table cellspacing="0" cellpadding="3" width="60%" align="center" border="0">
    <br />
    <tbody>
    <tr>
    <br />
    <td valign="top" width="40%">
    <h1><!--p echo($title);--></h1></td>
    <br /></tr>
    <br /></tbody></table>
    <br />
    <table cellspacing="0" cellpadding="5" width="60%" align="center" border="0">
    <br />
    <tbody>
    <tr>
    <br /><!--p<-->// Display opening 
    <td>tag 
    <br />if ($cell) 
    <br />echo(" </td>
    <td>"); 
    <br />echo($msg); 
    <br />
    <br />// Display closing </td>
    <td>tag 
    <br />if ($cell) 
    <br />echo("</td>"); 
    <br />

     
    <br /></tr>
    <br /></tbody></table>
    <br /></td>
    <br /></tr>
    <br /></tbody></table>
    <br />
    <br /><!--p<-->} 
    <br />

    </p>

    >

    More MySQL Articles
    More By Frank Manno


     

       

    MYSQL ARTICLES

    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway