Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gombos Lorand  >  PDO_DB  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Example
Class: PDO_DB
Execute database queries from parameters using PDO
Author: By
Last change:
Date: 2009-03-02 07:23
Size: 624 bytes
 

Contents

Class file image Download
<?php
/*Include the DB Class file.*/
include_once 'DB.php';
/*New Connection*/
$c = new DB();
$query "SELECT * FROM users WHERE message_id = 24";
/*Get one row, if many get the first*/
print "<pre>";
print_r($c->getRow($query));
print 
"</pre>";

/*Get all rows*/
print "<pre>";
print_r($c->getResults($query));
print 
"</pre>";

$data = array('text'=>'updated message');
$where = array('message_id = 24');
/*Update data: update message text where the message_id = 24*/
$c->update('users',$data,$where);

$where = array('message_id = 24');
/*Delete message with id 24*/
$c->delete('users',$where);
?>