98 lines
3.2 KiB
PHP
Executable File
98 lines
3.2 KiB
PHP
Executable File
<?php
|
|
$done = false;
|
|
if (!$done) {
|
|
|
|
ini_set('memory_limit', '10G');
|
|
|
|
$name_db = "aqdamypanel_AQDAMY_DATA2";
|
|
$host_db = "localhost";
|
|
$user_db = "aqdamypanel_mysql";
|
|
$pass_db = "AST4dxy6vEsi";
|
|
|
|
$db = new mysqli($host_db, $user_db, $pass_db, $name_db);
|
|
if ($db->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");
|
|
|
|
|
|
$get_from_old = mysqli_query($db,
|
|
"SELECT `number`, `count` FROM `package_still_have_final` ORDER BY `package_still_have_final`.`number` ASC"
|
|
);
|
|
|
|
$old_data= array();
|
|
if (mysqli_num_rows($get_from_old) > 0) {
|
|
while ($row_from_old = mysqli_fetch_assoc($get_from_old)) {
|
|
|
|
array_push($old_data, array(
|
|
'mobile' => $row_from_old['number'],
|
|
'count' => $row_from_old['count']
|
|
));
|
|
}
|
|
}
|
|
|
|
$name_db = "aqdamypanel_aqdamy";
|
|
$host_db = "localhost";
|
|
$user_db = "aqdamypanel_mysql";
|
|
$pass_db = "AST4dxy6vEsi";
|
|
|
|
$db = new mysqli($host_db, $user_db, $pass_db, $name_db);
|
|
if ($db->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");
|
|
|
|
//count($old_data)
|
|
for ($i=0; $i < count($old_data); $i++) {
|
|
$mobile = $old_data[$i]['mobile'];
|
|
$count = $old_data[$i]['count'];
|
|
|
|
$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'.$$mobile ;
|
|
exit;
|
|
}
|
|
|
|
for ($z=0; $z < $count; $z++) {
|
|
if (!mysqli_query(
|
|
$db,
|
|
"INSERT INTO `tretment_has_service`(`tretment_id`, `services_id`, `inv_from_db_tables_id`, `inv_table_id`, `done_id`, `user_id`, `activation_id`)
|
|
VALUES ('$mobile', '1', '10','0','1','1','2')"
|
|
)) {
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// عرض كل الحجوزات
|
|
//SELECT booking_users.mobile , `booking_utf8`.`massage` ,`booking_utf8`.`date`,`booking_utf8`.`session`,`booking_utf8`.`date_sub`, `booking_utf8`.`masseur`,`booking_utf8`.`active`,`booking_utf8`.`by_user`,`booking_utf8`.`pay_by`,`booking_utf8`.`note`,`booking_utf8`.`branche`,`booking_utf8`.`canceled_by`
|
|
//
|
|
//FROM `booking_utf8`
|
|
//LEFT JOIN booking_users ON booking_users.id = booking_utf8.userid
|
|
//
|
|
//WHERE ((`booking_users`.`mobile` LIKE '9665%' AND CHAR_LENGTH(`booking_users`.`mobile`) = 12) OR (`booking_users`.`mobile` LIKE '5%' AND CHAR_LENGTH(`booking_users`.`mobile`) = 9))
|
|
//
|
|
//GROUP BY booking_utf8.`id`
|
|
//ORDER BY `booking_utf8`.`by_user` DESC
|
|
// عرض كل الحجوزات
|
|
|
|
|
|
// العموظفين اللي حجزوا
|
|
//SELECT id FROM booking_users WHERE reception IN(1,2)
|
|
|
|
?>
|