<?php
 
 
/*
 
Setting fetch mode for ADODB for further information about this read the ADODB documentation
 
*/
 
define('ADODB_FETCH_ASSOC',2);
 
define('ADODB_ASSOC_CASE', 2); # use native-case for ADODB_FETCH_ASSOC
 
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
 
 
include("adodb/adodb.inc.php");
 
include("data_objects.php");
 
 
$database = &ADONewConnection('mysql');
 
$database->Connect('localhost', 'root', '', 'catalogo'); # connect to DB
 
 
$table = new dataObject($database, "producto"); // Opens the table called producto
 
 
$table->load(2);  // If the PK is a single field index just send the Id
 
//$table->load(array("id"=>2, "client_id"=>1)); // If the PK is composed send the multiple fields as an array
 
 
$table->set('nombre', "Vino de cocox");
 
$table->set('cantidad', 6);
 
$table->set('valor', 14);
 
 
// If the product using the selected ID doesn't exists the register is inserted, else is updated
 
$table->store();
 
 
//$table->delete();
 
print $table->_error;  // If there is no error then nothing is printed.
 
 
?>
 
 |