<?php
// Mysql connection class
// Made in 27/02/2004 by Vinícius Augusto Tagliatti Zani
// GPL License
// <viniciustz@mtv.com.br>
include_once("Mysql.class.php");
// example of use:
$dbName = "nome_do_banco";
$host = "localhost";
$user = "root";
$password = "";
$query = new Mysql($host, $user, $password);
$query->selectDb($dbName);
$query->whereAdd("name = 'bob'");
$query->orderBy("name");
$query->limit(0,15);
$query->query("SELECT * FROM table");
echo "The query executed was:<BR>";
echo $query->finalQuery;
echo "<BR><BR>";
//////////////////////////////////////////////////
// 1st fetch method
while ($user = $query->fetch()) {
echo "Name: " . $user->name . "<BR>";
}
//////////////////////////////////////////////////
///////////////////////////////////////////////////
// 2nd fetch type
$new_query = $query; // clone
$new_query->find();
while ($new_query->fetchToThis()) {
echo "Name: " . $new_query->name . "<BR>";
}
//////////////////////////////////////////////////
echo "End.";
?>
|