Skip to content
Snippets Groups Projects
Commit da4ad0b6 authored by Aldrich Valentino Halim's avatar Aldrich Valentino Halim
Browse files

transaction insertion fixed

parent 819db816
1 merge request!42Projekers - 13515051 - Girvandi Ilyas
...@@ -54,6 +54,7 @@ if(isset($_GET['driverId'])){ ...@@ -54,6 +54,7 @@ if(isset($_GET['driverId'])){
if(isset($_POST['pickup'])){ if(isset($_POST['pickup'])){
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
//echo $date;
$pickup = $_POST['pickup']; $pickup = $_POST['pickup'];
$destination = $_POST['destination']; $destination = $_POST['destination'];
$driverId = $_POST['driverId']; $driverId = $_POST['driverId'];
...@@ -63,6 +64,6 @@ if(isset($_POST['pickup'])){ ...@@ -63,6 +64,6 @@ if(isset($_POST['pickup'])){
$comment = $_POST['comment']; $comment = $_POST['comment'];
$transaction = new Order(); $transaction = new Order();
$transaction->setTransaction($userId, $driverId, $pickup, $destination, $date, $rating, $comment); $transaction->setTransaction($userId, $driverId, $pickup, $destination, $date, $rating, $comment);
//header('Location: ../view/dashboard.php?id=1'); header('Location: ../view/dashboard.php?id='.$userId);
echo "berhasil"; //echo "berhasil";
} }
...@@ -12,9 +12,8 @@ class Order { ...@@ -12,9 +12,8 @@ class Order {
function setTransaction($userId, $driverId, $pickup, $destination, $transactionDate, $rating, $comment){ function setTransaction($userId, $driverId, $pickup, $destination, $transactionDate, $rating, $comment){
$con = mysqli_connect('localhost','root', '', 'projekers'); $con = mysqli_connect('localhost','root', '', 'projekers');
mysqli_select_db($con, 'projekers'); mysqli_select_db($con, 'projekers');
$sql = 'INSERT INTO transaction(user_id, driver_id, pickup, destination, date, rating, comment) VALUES(' $sql = 'INSERT INTO transaction(user_id, driver_id, pickup, destination, rating, comment, date) values('.
. $userId .','. $driverId .','. $pickup .','. $destination.','. $transactionDate.','.$rating.',' $userId.','.$driverId.',"'.$pickup.'","'.$destination.'",'.$rating.',"'.$comment.'","'.$transactionDate.'")';
. $comment.')';
mysqli_query($con, $sql); mysqli_query($con, $sql);
mysqli_close($con); mysqli_close($con);
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment