Hi guys, i'm tryng to check available when update a record! so i'm getting that the record is available!
Bellow my class and my proccess
//this is my function i use inside of my class
function getInfonupdate($display_name) {
$query = $this->link->query("SELECT * FROM tbl_types WHERE display_name != '$display_name'");
$rowcount = $query->rowCount();
if ($rowcount == 0) {
$result = $query->fetchAll();
return $result;
} else {
return $rowcount;
}
}
//and my proccess is
$check_availablity = $types->getInfonupdate($display_name);
if ($check_availablity == 0) {
$update = $types->editTypes($id_type_group, $display_name, $description, $date_modified, $user_modified, $type_id);
if ($update == 1) {
$_SESSION['success'] = "<div class='alert alert-success alert-dismissable'>
<i class='fa fa-check'></i>
<button type='button' class='close' data-dismiss='alert'
aria-hidden='true'>
×
</button>
New Type {$display_name} has been successful Updated!
</div>'";
header('Location: ../edit_type.php?success');
}
}
So when i run i get the user is olready added! like i count update a query!
And i've no idea how to check when update a record!