PHP
  Home arrow PHP arrow Page 10 - The Soothingly Seamless Setup of Apach...
The Best Selling PC Migration Utility.
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
PHP

The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP
By: Israel Denis Jr. and Eugene Otto
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 41
    2000-06-07

    Table of Contents:
  • The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP
  • Assumptions
  • Prerequisites
  • How it Works
  • Game Plan
  • PHP Installation (*NIX)
  • Apache
  • Testing Our Work: Is Apache working?
  • Is SSL Working?
  • Are PHP and MySQL Working Together?
  • Conclusion

  • 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
     
     
    FaxWave - Free Trial.
     
    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

    The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP - Are PHP and MySQL Working Together?
    (Page 10 of 11 )

    Now, we can confirm that PHP is working with MySQL by creating a simple script to do some inserting and deleting of data from the "test2" database. Again this is just a simple script to see if it worked. In another article we will talk about PHP scripting to connect to a MySQL database. Remember, we already created the database and a table. We could had done it here, but chose not to. We wanted to double check that root had privileges to create DB and tables. However, PHP provides support for MySQL so we can easily write code to create a testing database and several records.

    Remember, we created the "books" table prior to getting to this point. This portion will not work if you skipped prior sections. We created the "test2" database with a "books" table, and inserted a record for a book.

    This script basically goes through the table and list all the fields by name. It's very simple.
    <?

    $dbuser = 'root';

    $dbhost = 'localhost';

    $dbpass = 'password';

    $dbname = 'test2';

    $dbtble = 'books';

    $mysql_link = mysql_connect($dbhost,$dbuser,$dbpass);

    $column = mysql_list_fields($dbname,$dbtble,$mysql_link);

    for($i=0; $i< mysql_num_fields($column); $i++ )
    {
    print mysql_field_name($column,$i )."<br>";
    }

    ?>

    A more complex example will show you some of the cool features of PHP.
    <html>
    <head>
    <title>Example 2 -- more details</title>
    </head>
    <body bgcolor="white">
    <?

    $dbuser = 'root';

    $dbhost = 'localhost';

    $dbpass = 'password';

    $dbname = 'test2';

    $dbtable = 'books';

    //------ DATABASE CONNECTION --------//
    $mysql_link = mysql_connect($dbhost,$dbuser,$dbpass);
    $column = mysql_list_fields($dbname,$dbtable,$mysql_link);
    $sql = "SELECT * FROM $dbtable";
    $result = mysql_db_query($dbname,$sql);
    ?>
    <table bgcolor="black">
    <tr><td>
    <table><!---- Inside Table ---->
    <?
    while($value = mysql_fetch_array($result))
    {
    print "<tr BGCOLOR=YELLOW>";
    //This loop goes through the colums and prints
    //each value
    for($i=0; $i< mysql_num_fields($column); $i++ )
    {
    print "<td> $value[$i] </td>";
    }
    print "</tr>";
    }
    mysql_free_result($result);
    mysql_close();
    ?>
    </table><!---- Inside Table ----->
    </td></tr>
    </table>

    </body>
    </html>


    Notice, how you can have both HTML and PHP commands inside the same file, one of the nice things about PHP scripts. Because you begin with "Next: Conclusion >>
     

    More PHP Articles
    More By Israel Denis Jr. and Eugene Otto


     

       

    PHP ARTICLES

    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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