/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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]."') "; { return false; } //Return the created contact } 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; { return false; } //Return contact return $this->getOne( $id ); } }