0){ $user = mysqli_fetch_array($check, MYSQLI_ASSOC); $text = "A user named ". $user['name']." already exists with the same contact number. Do you still want to continue? This will update the Patient Name as ".$name." in the database"; $arr[] = array('text'=>$text, 'light'=>1); }else{ $arr[] = array('text'=>'empty', 'light'=>2); } echo json_encode($arr); ?>