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"); $not_in = ''; $check = mysqli_query($db, "SELECT `name`, `username`, `pass`, `number` FROM `old_reception` WHERE `emp_id` IS NULL" ); while($old_data_temp_id = mysqli_fetch_assoc($check)) { $name = $old_data_temp_id['name']; $username = $old_data_temp_id['username']; $password = $old_data_temp_id['pass']; $mo_number = $old_data_temp_id['number']; if (mysqli_query( $db, "INSERT INTO `emplyee`(`name`, `branch_id`, `occupation_id`, `G_sex_id`, `emplyee_status_id`, `holi_days_id`, `user_id`, `activation_id`) VALUES ('$name','2','1','1','1','1','1','2')" )) { $last_id = mysqli_insert_id($db); if (mysqli_query( $db, "INSERT INTO `user`(`name`, `username`, `pass`, `number`, `emp_active_status_id`, `account_interaction_id`, `emplyee_id`, `user_id`, `activation_id`) VALUES ('$name','$username','$password','$mo_number','2','1','$last_id','1','2')" )) { } } } $not_in = rtrim($not_in, ","); echo $not_in; } ?>