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'])){
if(isset($_POST['pickup'])){
$date = date('Y-m-d H:i:s');
//echo $date;
$pickup = $_POST['pickup'];
$destination = $_POST['destination'];
$driverId = $_POST['driverId'];
......@@ -63,6 +64,6 @@ if(isset($_POST['pickup'])){
$comment = $_POST['comment'];
$transaction = new Order();
$transaction->setTransaction($userId, $driverId, $pickup, $destination, $date, $rating, $comment);
//header('Location: ../view/dashboard.php?id=1');
echo "berhasil";
header('Location: ../view/dashboard.php?id='.$userId);
//echo "berhasil";
}
......@@ -12,9 +12,8 @@ class Order {
function setTransaction($userId, $driverId, $pickup, $destination, $transactionDate, $rating, $comment){
$con = mysqli_connect('localhost','root', '', 'projekers');
mysqli_select_db($con, 'projekers');
$sql = 'INSERT INTO transaction(user_id, driver_id, pickup, destination, date, rating, comment) VALUES('
. $userId .','. $driverId .','. $pickup .','. $destination.','. $transactionDate.','.$rating.','
. $comment.')';
$sql = 'INSERT INTO transaction(user_id, driver_id, pickup, destination, rating, comment, date) values('.
$userId.','.$driverId.',"'.$pickup.'","'.$destination.'",'.$rating.',"'.$comment.'","'.$transactionDate.'")';
mysqli_query($con, $sql);
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