$image_name = upload_image($_FILES, $location); $has_partner = 0; if (isset($_POST['female_name'])) { $has_partner = 1; } $sql = build_insert_str("s_male", array($id + 2, $_POST['male_name'], $_POST['male_dob'], $_POST['male_email_id'], $_POST['male_mobile'], $_POST['male_blood_group'], $_POST['male_occupation'], $_POST['male_off_addr1'], $_POST['male_off_area'], $_POST['male_off_pincode'], $_POST['male_off_phone'], $has_partner, $id + 3)); if ($result = mysqli_query($connection, $sql)) { //echo "Executed Successfully..."; } $sql = build_insert_str("s_female", array($id + 3, $_POST['female_name'], $_POST['female_dob'], $_POST['female_email_id'], $_POST['female_occupation'], $_POST['female_mobile'], $_POST['female_blood_group'], $has_partner, $id + 2)); //echo $sql; if ($result = mysqli_query($connection, $sql)) { //echo "Executed Successfully..."; } $kid_id = pow(10, 4) + ($id + 2) / 2 * 10; $sql = build_insert_str("s_common", array($id + 2, $_POST['comm_wedding_date'], $_POST['comm_res_addr1'], $_POST['comm_res_area'], $_POST['comm_res_pincode'], $_POST['comm_res_phone'], $_POST['comm_no_of_children'], $kid_id)); if ($result = mysqli_query($connection, $sql)) { //echo "Executed Successfully..."; } $no_of_kids = (int) $_POST['comm_no_of_children']; if ($no_of_kids > 0) { for ($i = 0; $i < $no_of_kids; $i++) { $kid_id = pow(10, 4) + $i + ($id + 2) / 2 * 10; $sql = build_insert_str("s_kids", array($kid_id, $id + 2, $_POST["kid_name" . $i], $_POST['kid_dob' . $i], $_POST['kid_blood_group' . $i], $_POST['kid_mobile_no' . $i], $_POST['kid_email_id' . $i])); if ($result = mysqli_query($connection, $sql)) { //echo "Kids Executed Successfully..."; } } } header("Location:index.php"); }
<?php include "functions.php"; $table_name = "kids"; $arr_column = get_table_fields($table_name); $arr_table_values = get_table_values($table_name); $str = "CREATE TABLE IF NOT EXISTS " . $table_name . " ("; foreach ($arr_column as $key => $value) { $str .= $value['Field'] . " " . get_field_value($value) . ", "; } $str = rtrim($str, ", "); $str .= ")&#"; //echo "<pre>"; //print_r($arr_table_values); //echo "</pre>"; foreach ($arr_table_values as $key => $value) { $str .= build_insert_str($table_name, $value) . "&#"; } //header("Content-Type: text/html charset=utf-8"); $str = utf8_encode(nl2br(rtrim($str, "&#"))); echo json_encode($str); mysqli_close($connection);
<?php include_once "function_random_string.php"; include_once "header_db.php"; include_once "functions.php"; $users = array('female', 'kids'); foreach ($users as $key => $value) { $sql = "SELECT id,Mobile FROM " . $value . ";"; if ($result = mysqli_query($connection, $sql)) { while ($row = mysqli_fetch_row($result)) { $no = (int) $row[1]; if (!($no == 0)) { $password = "******" . random_string(3); $sql = build_insert_str("users", array((int) $row[0], $row[1], $password)); echo $sql; mysqli_query($connection, $sql); } } } } //echo random_string(5);