<?php define('DB_SERVER', 'localhost'); define('DB_USER', 'sqlazo_user'); define('DB_PASSWORD', 'sqlazo_password'); define('DB_DATABASE','sqlazo_database');
include_once("./class.sqlazo.inc"); //the base class
$oTest = sqlazo_sel('mysql', DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE); //connect to DB_SERVER with credentials given in constants //don't change the first parameter; actually the class only suppport MySQL (or MySQLi, automatic selection)
$var1 = 'val1'; $var2 = 'v';
//$oTest->consulta("SELECT * FROM table"); //execute de query (simple query)
$oTest->consulta("SELECT field FROM table WHERE field = '%s' OR field LIKE '%%%s%%'", array($var1, $var2), 5); //execute de query with parameters and limited to the first 5 rows
while($oTest->leeFila()){ //read a row
echo($oTest->aFila['field']."<br/>\n"); //show a field
}
var_dump($oTest->aTiempos); //show times (conection, consult, ...)
if($oTest->getError()) var_dump($oTest->getError()); //show errors
$oTest->desconectar(); //disconnect
?>
|