Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kimmo Lankila  >  xDatabase  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: xDatabase
Simple MySQL database access wrapper
Author: By
Last change:
Date: 10 years ago
Size: 1,101 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
  </head>
  <body>
  <?php
    
// Add class to script.
    
require_once("class.xDatabase.php");
    
    
// Create new MySQL database object.
    
$database = new xDatabase("localhost""root""""mysql");
  
    
// Make query from "mysql" -database, using "Host" -column information as index.
    
$results $database->query("SELECT Host, User, Password FROM user WHERE User != ''""Host");
  
    
// Display results from query.
    
echo "Total number of rows in result set : ".$database->DB_RESULT_ROWS."<br><br>\n";
  
    echo 
"<table width=\"80%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
   
    foreach (
$results['localhost'] as $local_user)
    {
      echo 
"<tr><td>".$local_user['Host']."</td><td>".$local_user['User'];
      echo 
"</td><td>".$local_user['Password']."</td></tr>\n";
    }
  
    echo 
"</table>\n";
  
    
// Close database connection.
    
$database->close();
  
?>
  </body>
</html>