Return to Snippet

Revision: 9825
at November 24, 2008 10:54 by czapata


Initial Code
<?php

     # Define MySQL Settings
     define("MYSQL_HOST", "");
     define("MYSQL_USER", "");
     define("MYSQL_PASS", "");
     define("MYSQL_DB", "");

     $conn = mysql_connect("".MYSQL_HOST."", "".MYSQL_USER."", "".MYSQL_PASS."") or die(mysql_error());
     mysql_select_db("".MYSQL_DB."",$conn) or die(mysql_error());

     $sql = "SELECT * FROM YourTableName";
     $res = mysql_query($sql);

     while ($field = mysql_fetch_array($res))
     {
         echo 'FieldName1: ' . $field['fieldname1'] . '<br />';
         echo 'FieldName2: ' . $field['fieldname2'] . '<br /><br />';
     }
?>

Initial URL

                                

Initial Description

                                

Initial Title
Quick MySQL Connection Test

Initial Tags
mysql, php

Initial Language
PHP