PHP Classes

File: test.php

Recommend this page to a friend!
  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: 13 years ago
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);
?>

For more information send a message to info at phpclasses dot org.