$password = generateRandomString('5');
echo $password;
//Hash the password provided
$hash = encryptPassword($password);
//Save new password for user
//If already exists, then update password and if not insert record
$params = array();
$response = null;
$params = add_where('idPerson', $id, $params);
$response = select_from_table('password', 'idPerson', $params);
//echo $response;
if (empty(json_decode($response, true))) {
    //Insert
    $record = array();
    $records = array();
    $record = add_field('idPerson', $id, $record);
    $record = add_field('password', $hash, $record);
    $record = add_field('misses', "0", $record);
    $record = add_field('locked', "0", $record);
    array_push($records, $record);
    insert_into_table('password', $records);
} else {
    //Modify
    $update = array();
    $where = array();
    $update = add_field("password", $hash, $update);
    $update = add_field("misses", "0", $update);
    $update = add_field("locked", "0", $update);
    $where = add_where("idPerson", $id, $where);
    modify_record('password', $update, $where);
}
//Build Fields and Values to insert
$record = array();
$records = array();
$record = add_field("nameLast", "Lee", $record);
$record = add_field("nameFirst", "Susan", $record);
$record = add_field("nameNick", "Sue", $record);
$record = add_field("email", "*****@*****.**", $record);
$record = add_field("address1", "1224 Topeka Drive", $record);
$record = add_field("zip", "76131", $record);
$record = add_field("phone", "8176920840", $record);
$record = add_field("sex", "F", $record);
$record = add_field("birthdate", "19620311", $record);
$record = add_field("mileRange", "25", $record);
array_push($records, $record);
$record = array();
//clear array for record
$record = add_field("nameLast", "Lee", $record);
$record = add_field("nameFirst", "Aaron", $record);
$record = add_field("nameNick", "Fluffy", $record);
$record = add_field("email", "*****@*****.**", $record);
$record = add_field("address1", "1224 Topeka Drive", $record);
$record = add_field("zip", "76131", $record);
$record = add_field("phone", "8176920000", $record);
$record = add_field("sex", "M", $record);
$record = add_field("birthdate", "19960101", $record);
$record = add_field("mileRange", "15", $record);
array_push($records, $record);
//echo json_encode($records). "<br>";
insert_into_table($table, $records);
//$response = select_from_table('person', $fields, $where);
//echo ($response);