Login   Register  
PHP Classes
elePHPant
Icontem

File: ClassTestFile/testQueryManager.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Guerrieri Luca  >  PXAServer  >  ClassTestFile/testQueryManager.php  >  Download  
File: ClassTestFile/testQueryManager.php
Role: Example script
Content type: text/plain
Description: Test for Query Manager Class
Class: PXAServer
Library to build applications configured with XML
Author: By
Last change:
Date: 7 years ago
Size: 1,227 bytes
 

Contents

Class file image Download
<?php
/*
 *File di test della classe QueryManager
 *Questa classe  in grado:
 *- recuperare query dal file libquery.inc.php
 *- creare query dinamiche con parametri passati come array (placeholders e valori)
 */
require('../libreria/global.inc.php');

print(
"<b>Test con QM statica</b><br>");

$Qm = new QueryManager;
$Qm ->set_query('Q_utenti');
echo 
$Qm ->get_static_query()."<br><br>";
print(
"<b>Test con QM dinamica</b><br>");
$Qm ->set_query('Q_username');        // <!-- dynamic -->SELECT * FROM `utenti`WHERE username='<!-- username -->'
echo "Query da eseguire: (per vederla controlla il sorgente di questo documento ) <!-- dynamic -->SELECT * FROM `utenti`WHERE username='<!-- username -->'";
$placeholders=array("username");
print(
"<br>Passo al QM l'array che contiene i segnaposto :");
print_r($placeholders);
$valori=array("pippo");
print(
"<br>Passo al QM l'array che contiene i valori da sostituire ai segnaposto :");
print_r($valori);
$Qm ->set_placeholders($placeholders);    //imposto i nomi delle variabili nella query
$Qm ->set_data($valori);    //imposto i nomi delle variabili nella query
echo "<br>Questa  la query una volta composta<br>";
echo 
"<b>".$Qm ->get_dynamic_query()."</b>";
?>