store()

Determines if the primary keys are set and the record already exists, if it does it updates, otherwise it inserts.

Example:

example.php
<?php
include("lib.php");
load("person");

$p = new person($_GET["person_id"]);
$p->set_state("FL");
if (!
$p->store())
{
    echo 
"Failed to update";
    return 
0;
}
echo 
"Update Successful";
?>




example2.php
<?php
include("lib.php");
load("person");

$p = new person;
$p->set_name("Bob");
if (!
$p->store())
{
    echo 
"Failed to insert";
    return 
0;
}
echo 
"Insert Successful";

?>