Source for file queries.php
Documentation is available at queries.php
* Examples how to Fetch data from a table.
* First a single-row function is called (SELECT VERSION()).
* Second a multi-row function is called (SHOW VARIABLES).
* Also GetQueryCount() and GetQueryTime() usage is shown.
* @author Sascha 'SieGeL' Pfalz <php@saschapfalz.de>
* @version 0.36 (21-Sep-2008)
* $Id: queries.php,v 1.3 2008/09/21 21:07:08 siegel Exp $
* @license http://opensource.org/licenses/bsd-license.php BSD License
require
('functions.inc.php');
* First single-row query. The result of the query "SELECT VERSION()" returns a single
* string with the current MySQL server version. As the flag "MYSQL_NUM" is given to the
* class, the result is returned as an numbered array which has only the element 0 containing
$version =
$db->Query("SELECT VERSION()",MYSQL_NUM);
echo
($d['LF'].
'MySQL Database Version: '.
$version[0].
$d['LF']);
$stmt =
$db->QueryResult($query);
* Dump out the data from the stored resultset $stmt.
* The SQL statement 'SHOW VARIABLES' returns two values which are then accessable as $t[0] and $t[1],
* because the flag "MYSQL_NUM" is set, which returns one row of data as numbered array.
while($t =
$db->FetchResult($stmt,MYSQL_NUM))
printf("%30s: %s%s",$t[0],$t[1],$d['LF']);
echo
($d['LF'].
$db->GetQueryCount().
" queries took ".
round($db->GetQueryTime(),3).
" seconds.".
$d['LF'].
$d['LF']);
Documentation generated on Sat, 07 Aug 2010 10:18:27 +0200 by phpDocumentor 1.4.3