Location: PHPKode > scripts > DBInterface > example.php
<html>

<head>
  <title></title>
</head>

<body>

<?php

require_once('db.php');
require_once('mysql.php');
require_once('dbi.php');

$db = new MYSQL_DB($db_host,$db_user,$db_pass,$db_name);
$db->connect(); 
$mytable = new ARDBInterface($db,'table_name','id_field');

$mytable->set_id(1);
$mytable->load();
echo $mytable->field_name;

$mytable->set_id('');
$mytable->set_field(DBI_ALL_NULL); //These 2 lines clear all fields
$mytable->some_field = '1';
while ($mytable->load()) // or e.g. load(array('order' => 'field_name DESC'))
{
   // do whatever
}

$mytable->field_name = $value;
$mytable->update();

$mytable->import_fields($_POST); // $_POST['field_name'] would map to object and the class takes care of escaping DB queries before execution
$mytable->update();

$myarray = $mytable->fields_array();
echo $myarray['field_name'];

?>

</body>

</html>
Return current item: DBInterface