static public function addAccount() { $result = AccountCollection::verifyFields(); if(count($result)) return ($result); // if all right, save data. $_POST['id_account'] = $_POST['id_account'] ? $_POST['id_account'] : AccountCollection::generateAccountId(); $query = "INSERT INTO `account` ( `id` , `id_account` , `id_client` , `name` , `amount` , `id_currency` , `credit` , `debit` , `vdate1` , `vdate2` , `created_at` ) VALUES ( NULL , '".$_POST['id_account']."', '".$_POST['client']."', '".$_POST['aname']."', '".$_POST['amount']."', '".$_POST['currency']."', '".$_POST['credit']."', '".$_POST['debit']."', '".$_POST['valuec']."', '".$_POST['valued']."', CURRENT_TIMESTAMP );"; //die($query); mysql_query($query); header($_POST['id_account']? 'location: account_updated.php':'location: account_created.php'); }