Rename update_id to update_count - as it's a count, not the insert ID

This commit is contained in:
Marcus Hill
2022-05-01 10:34:21 +01:00
parent 69c1fc6cae
commit 25c610e963
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ require('../require_post_method.php');
$asset_id = intval($_POST['asset_id']); $asset_id = intval($_POST['asset_id']);
// Default // Default
$update_id = FALSE; $update_count = FALSE;
if(!empty($asset_id)){ if(!empty($asset_id)){
@@ -109,7 +109,7 @@ if(!empty($asset_id)){
// Check insert & get insert ID // Check insert & get insert ID
if($update_sql){ if($update_sql){
$update_id = mysqli_affected_rows($mysqli); $update_count = mysqli_affected_rows($mysqli);
//Logging //Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Asset', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Asset', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_client_id = $client_id, company_id = $company_id");
+2 -2
View File
@@ -8,7 +8,7 @@ $contact_id = intval($_POST['contact_id']);
include('contact_model.php'); include('contact_model.php');
// Default // Default
$update_id = FALSE; $update_count = FALSE;
if(!empty($name) && !empty($email)){ if(!empty($name) && !empty($email)){
@@ -16,7 +16,7 @@ if(!empty($name) && !empty($email)){
// Check insert & get insert ID // Check insert & get insert ID
if($update_sql){ if($update_sql){
$update_id = mysqli_affected_rows($mysqli); $update_count = mysqli_affected_rows($mysqli);
//Logging //Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Contact', log_action = 'Updated', log_description = '$name via API ($api_key_name)', log_ip = '$ip', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id");
+2 -2
View File
@@ -7,10 +7,10 @@
*/ */
// Check if the insert query was successful // Check if the insert query was successful
if(isset($update_id) && is_numeric($update_id) && $update_id > 0){ if(isset($update_count) && is_numeric($update_count) && $update_count > 0){
// Insert successful // Insert successful
$return_arr['success'] = "True"; $return_arr['success'] = "True";
$return_arr['count'] = $update_id; $return_arr['count'] = $update_count;
} }
// Query returned false: something went wrong, or it was declined due to required variables missing // Query returned false: something went wrong, or it was declined due to required variables missing