<?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);
?>
|