Login   Register  
PHP Classes
elePHPant
Icontem

File: queryManagerTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gurdeep Singh  >  MySQLWrapper  >  queryManagerTest.php  >  Download  
File: queryManagerTest.php
Role: Example script
Content type: text/plain
Description: Simple file to show, how we can use methods from QueryManager.php
Class: MySQLWrapper
Execute MySQL database queries programmatically
Author: By
Last change:
Date: 2007-12-30 11:04
Size: 1,306 bytes
 

Contents

Class file image Download
<?php
require_once('./MySQLWrapper/QueryManager.php');
$qm QueryManager::getInstance();
$columnValueArray = array('email'=>array('root@localhost'));
$qm->countRowsInTable("user"$columnValueArraytrue"or""and");

echo 
"<br /><br />";
$qm->executeMyQuery("Select * from user");

echo 
"<br /><br />";
$qm->selectAllFromTable("user""username='gurdeep'");

echo 
"<br /><br />";
$columnArray "username, email, enabled";
$condition "username like '%gurdeep%'";
$qm->selectColumnValueFromTable("user"$columnArray$condition);

echo 
"<br /><br />";
$tableArray = array('id'=>array(int'Not Null''Auto_increment''primary key'), 'username'=>array('varchar(255)''Not Null'), 'password'=>array('varchar(255)''Not null'), 'FirstName'=>array('varchar(255)'), 'lastName'=>array('varchar(255)'));
$qm->createTable("user"$tableArray);

echo 
"<br /><br />";
echo 
$encPassword md5('gurdeep');
$valueArray = array('username'=>'gurdeep''password'=>$encPassword'FirstName'=>'Gurdeep''LastName'=>'Singh');
$qm->insertIntoTable("user"$valueArray);

echo 
"<br /><br />";
$valueArray = array('username'=>'harleen''password'=>md5('gurdeep'));
$qm->updateTable("user"$valueArray"id=1");

echo 
"<br /><br />";
$qm->deleteFromTable("user""id=2"false);

?>