connect_error) { die("Connection failed: " . $db->connect_error); } // Change db to "test" db //// mysqli_select_db($db, "test"); $Arabic= 'SET CHARACTER SET utf8'; mysqli_query($db,$Arabic) or die ('Can\'t charset in DataBase'); $db->set_charset("utf8"); $itis_in = ''; $check = mysqli_query($db, "SELECT `old_points`.`point`, `old_points`.`number` FROM `old_points` " ); if (mysqli_num_rows($check) > 0) { while ($check_row = mysqli_fetch_assoc($check)) { $point = $check_row['point']; $mobile22 = $check_row['number']; $mobile = $check_row['number']; $sel_mobile = mysqli_query($db,"SELECT `id` FROM `tretment` WHERE `number` = '$mobile' AND `commercial_register_id` = 2"); if (mysqli_num_rows($sel_mobile) == 1) { $row_mobile = mysqli_fetch_assoc($sel_mobile); $mobile = $row_mobile['id']; } else { echo 'mobile :'. $mobile22; exit; } if(!mysqli_query($db, "INSERT INTO `points` (`point`, `tretment_id`, `points_reason_id`, `user_id`, `activation_id`) VALUES ('$point', '$mobile','1','1','2') " )){ exit; } } } } ?>