Login   Register  
PHP Classes
elePHPant
Icontem

File: example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Hansen Wong  >  MySQL connection and query  >  example  >  Download  
File: example
Role: Example script
Content type: text/plain
Description: example
Class: MySQL connection and query
Connect and query MySQL databases
Author: By
Last change: update comment
Date: 2012-03-20 21:34
Size: 458 bytes
 

Contents

Class file image Download
<?php
/** http://chatfren.com/ **/
/** Chatfren Live: http://chatfren.com/chat.php?u=huang_hanzen **/
/** Example **/

require 'class_sql.php';
$db = array(
    
'host'        => 'localhost',
    
'username'    => 'root',
    
'password'    => '',
    
'database'    => 'test'
);

$db = new MySQL($db);
$sql 'SELECT * FROM `table` LIMIT 20';

$db->query($sql);
while(
$data $db->fetch()){
    
/** loop data here **/
}
echo 
'Total Rows: '.$db->rows();
$db->close();
?>