Revision: 9248
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 27, 2008 01:11 by jonniespratley
Initial Code
public function saveContact( $contact )
{
if ( $contact[contact_id] == 0 )
{
//Insert net
$sql = "INSERT INTO contacts
VALUES ( NULL,
'".$contact[contact_fname]."',
'".$contact[contact_lname]."',
'".$contact[contact_email]."',
'".$contact[contact_url]."',
'".$contact[contact_address]."',
'".$contact[contact_city]."',
'".$contact[contact_state]."',
'".$contact[contact_zip]."',
'".$contact[contact_photo]."',
'".$contact[contact_locationid]."')
";
if (!mysql_query( $sql ))
{
return false;
}
//Return the created contact
return $this->getOne( mysql_insert_id() );
} else {
//Update Contact
$id = $contact[contact_id];
$sql = "UPDATE contacts SET
contact_fname = '".$contact[contact_fname]."',
contact_lname = '".$contact[contact_lname]."',
contact_email = '".$contact[contact_email]."',
contact_url = '".$contact[contact_url]."',
contact_address = '".$contact[contact_address]."',
contact_city = '".$contact[contact_city]."',
contact_state = '".$contact[contact_state]."',
contact_zip = '".$contact[contact_zip]."',
contact_photo = '".$contact[contact_photo]."',
contact_locationid = '".$contact[contact_locationid]."'
WHERE contact_id =".$id;
if ( !mysql_query( $sql ) )
{
return false;
}
//Return contact
return $this->getOne( $id );
}
}
Initial URL
Initial Description
Initial Title
PHP Saving a vo to db with amfphp
Initial Tags
php, textmate
Initial Language
PHP