booking/work/data/offres.php
2025-03-24 19:02:58 +03:00

87 lines
2.4 KiB
PHP

<?php
$done = true;
if (!$done) {
$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`name_ar_utf`, `date` FROM `offres`"
);
$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(
'name' => $row_from_old['name_ar_utf'] . ' مؤرشف',
'date' => $row_from_old['date']
));
}
}
print_r($old_data);
echo ' / after / ';
$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");
for ($i=0; $i < count($old_data); $i++) {
$old_data_temp_name = $old_data[$i]['name'];
$old_data_temp_date = $old_data[$i]['date'];
$get_from_old = mysqli_query($db,
"INSERT INTO `an_employee_offer`(
`name`,
`discount`,
`upload_image_id`,
`type_discount_id`,
`does_discount_enters_id`,
`offer_does_have_dayoff_id`,
`offer_does_have_spical_time_id`,
`date_time`,
`user_id`,
`activation_id`)
VALUES (
'$old_data_temp_name',
'0',
'1',
'1',
'1',
'1',
'1',
'$old_data_temp_date',
'1',
'1'
)"
);
}
}
?>