mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Correct insert ID for create endpoint. Add contact create API endpoint
This commit is contained in:
@@ -7,27 +7,19 @@
|
||||
*/
|
||||
|
||||
// Check if the insert query was successful
|
||||
if($insert_sql){
|
||||
$insert_id = $mysqli->insert_id;
|
||||
if(isset($insert_id) && is_numeric($insert_id)){
|
||||
// Insert successful
|
||||
$return_arr['success'] = "True";
|
||||
$return_arr['count'] = '1';
|
||||
$return_arr['data'][] = [
|
||||
'insert_id' => $insert_id
|
||||
];
|
||||
}
|
||||
// We shouldn't get here
|
||||
else{
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "Auth success but insert failed, possibly database connection. Seek support if this error continues.";
|
||||
}
|
||||
if(isset($insert_id) && is_numeric($insert_id)){
|
||||
// Insert successful
|
||||
$return_arr['success'] = "True";
|
||||
$return_arr['count'] = '1';
|
||||
$return_arr['data'][] = [
|
||||
'insert_id' => $insert_id
|
||||
];
|
||||
}
|
||||
|
||||
// Query returned false, something went wrong or it was declined due to required variables missing
|
||||
else{
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "Auth success but insert query failed, ensure required variables are provided and database schema is up-to-date.";
|
||||
$return_arr['message'] = "Auth success but insert query failed, ensure ALL required variables are provided and database schema is up-to-date. Turn on error logging and look for 'undefined index'";
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
|
||||
Reference in New Issue
Block a user