$reservationID = $_GET['reservationID']; $myquery = "SELECT vehicle_id FROM vehicle_table WHERE reservation_id = {$reservationID}"; $query = mysql_query($myquery); if ($query) { $data = mysql_fetch_array($query); //print_r($data); } else { echo 0; } $vehicleID = $data['vehicle_id']; //TODO reservatin-Id must 0 $myquery = "UPDATE vehicle_table SET main_status = 'Busy',reservation_id=0 WHERE vehicle_id = {$vehicleID}"; $query = mysql_query($myquery); //echo $vehicleID.'<br>'; $myquery = "SELECT customer_id FROM reservation_table WHERE reservation_id= {$reservationID}"; $query = mysql_query($myquery); $data = mysql_fetch_array($query); //print_r($data); $customerID = $data['customer_id']; $jobID = getLastID('job_table', 'job_id'); $jobID++; $myquery = "INSERT INTO job_table(job_id,customerid, vehicle_id,reservation_id, ride_status,fees)\n VALUES ({$jobID},{$customerID},{$vehicleID},{$reservationID},'Start',0)"; //echo $myquery; $query = mysql_query($myquery); if ($query) { //echo 'ok'; echo $jobID; } else { echo 0; } //TODO delete reservation
} // --------------------------- // データ登録 // --------------------------- $db->beginTransaction(); if ($div == 'add') { // --- TBL: sop $sop_id = -1; $rslt = addSop($db, $sop_id, $pj_id, $sop_name, $checker_required_flag); if (!$rslt) { \Sop\Log::error(__FILE__, __LINE__, 'Failed to add sop.'); $msg004 = "The registration failed.: sop"; // 登録に失敗しました: sop \Sop\Api::exitWithError(array($msg004)); } $sop_id = getLastID($db); // --- TBL: history $history_id = -1; $rslt = addHistory($db, $history_id, $pj_id, $sop_id, null, null, null, null, $HISTORY_ACTION_SOP_ADD, date("Y-m-d H:i:s"), $user_id, null, null); if (!$rslt) { \Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.'); $msg005 = "The registration failed.: history"; // 登録に失敗しました: history \Sop\Api::exitWithError(array($msg005)); } } if ($div == 'upd') { // --- TBL: sop $rslt = updSop($db, $sop_id, $sop_name, $checker_required_flag); if (!$rslt) { \Sop\Log::error(__FILE__, __LINE__, 'Failed to update sop.');
* Time: 12:45 AM */ require 'connect.php'; require 'functions.php'; $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; $telephone = $_GET['telephone']; $username = $_GET['username']; $password = $_GET['password']; $telephone = (int) $telephone; $userid = getLastID('user_table', 'user_id'); $userid += 1; $myquery = "INSERT INTO user_table(user_id, user_name, password, privilege_number, user_type)\nVALUES ({$userid},'{$username}','{$password}','5','passenger')"; $query = mysql_query($myquery); if (!$query) { echo mysql_error(); die; } else { $customerID = getLastID("customer_table", "customer_id"); $customerID++; $myquery = "INSERT INTO customer_table(customer_id, user_id, first_name, last_name, telephone_number) VALUES ({$customerID},{$userid},'{$firstname}','{$lastname}',{$telephone})"; //echo $myquery; $query = mysql_query($myquery); if (!$query) { echo mysql_error(); die; } else { echo 1; } } mysql_close($server);
\Sop\Api::exitWithError(array($msg019)); } $tbl_id = getLastID($db); // --- TBL: clmn foreach ($clmn_list as $idx => $clmn) { $input_required = (bool) $clmn['input_required'] == true ? $INPUT_REQUIRED : $INPUT_REQUIRED_NOT; $clmn_id = -1; $rslt = addClmn($db, $clmn_id, $pj_id, $sop_id, $tpl_id, $schema_id, $tbl_id, $clmn['clmn_name'], $clmn['input_type'], $input_required); if (!$rslt) { unlink($file_path); \Sop\Log::error(__FILE__, __LINE__, 'Failed to add clmn.'); $msg020 = "The registration failed: clmn"; // 登録に失敗しました: clmn \Sop\Api::exitWithError(array($msg020)); } $clmn_list[$idx]['clmn_id'] = getLastID($db); // row 更新用 } // --- TBL: row foreach ($sheet_data as $row_order => $row) { foreach ($row as $idx => $row_text) { $clmn_id = $clmn_list[$idx + 1]['clmn_id']; $row_id = -1; $rslt = addRow($db, $row_id, $pj_id, $sop_id, $tpl_id, $schema_id, $tbl_id, $clmn_id, $row_text, $row_order); if (!$rslt) { unlink($file_path); \Sop\Log::error(__FILE__, __LINE__, 'Failed to add row.'); $msg021 = "The registration failed: row"; // 登録に失敗しました: row \Sop\Api::exitWithError(array($msg021)); }
// --------------------------- // データ登録 // --------------------------- $db->beginTransaction(); if ($div == 'add') { // --- TBL: pj $pj_id = -1; $rslt = addPj($db, $pj_id, $pj_name); if (!$rslt) { unlink($file_path); \Sop\Log::error(__FILE__, __LINE__, 'Failed to add project.'); $msg010 = "The registration failed.: pj"; // 登録に失敗しました: pj \Sop\Api::exitWithError(array($msg010)); } $pj_id = getLastID($db); // --- TBL: grp_pj $rslt = addGrpPj($db, $grp_id, $pj_id); if (!$rslt) { unlink($file_path); \Sop\Log::error(__FILE__, __LINE__, 'Failed to add grp_pj.'); $msg011 = "The registration failed.: grp_pj"; // 登録に失敗しました: grp_pj \Sop\Api::exitWithError(array($msg011)); } // --- TBL: history $history_id = -1; $rslt = addHistory($db, $history_id, $pj_id, null, null, null, null, null, $HISTORY_ACTION_PJ_ADD, date("Y-m-d H:i:s"), $user_id, null, null); if (!$rslt) { unlink($file_path); \Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.');
<?php /** * Created by PhpStorm. * User: pamba * Date: 10/31/2015 * Time: 2:13 AM */ require 'connect.php'; require 'functions.php'; $customerId = $_GET['customer_id']; $subject = $_GET['subject']; $comment = $_GET['comment']; $customerId = (int) $customerId; $feedbackId = getLastID("feedback_table", "feedback_id"); $feedbackId++; $myquery = "INSERT INTO feedback_table(feedback_id,customer_id, subject_name, comment)\n VALUES ({$feedbackId},{$customerId},'{$subject}','{$comment}')"; echo $myquery; $query = mysql_query($myquery); if (!$query) { echo mysql_error(); die; } else { echo 1; }