-1

i have exploded timestamp2w to date and time. I can post the date to the database but the time isn't posting, but if i echo it, it is showing the time. i want to post that time to the db.

 $timestamp3=$_POST['timestamp']; $timestamp3x=explode(" ",$timestamp3); $timestamp=$timestamp3x[0]; $timestamp3=$timestamp3x[1]; $datetime=$_POST['$timestamp3']; $transactiondate =date("Y-m-d"); $userid=$_SESSION['userid']; $equipmentid = $_GET['id']; echo $timestamp3; $sql="Insert into tbl_booking(equipmentid,book_to,book_from,transactiondate,user_booked,datetime)VALUES('$equipmentid','$timestamp2','$timestamp','$transactiondate','$userid','$datetime')"; 
2
  • Erh, you haven't defined any connection to the database nor are you executing the query. Commented Apr 24, 2015 at 9:45
  • 1
    You're setting $timestamp3, but putting $timestamp2 in the database. Commented Apr 24, 2015 at 9:47

2 Answers 2

1

i think you have time value in $timestamp3 and you are sending $timestamp2 to mysql query so change your query like below

$sql="Insert into tbl_booking(equipmentid,book_to,book_from,transactiondate,user_booked,datetime)VALUES('$equipmentid','$timestamp3','$timestamp','$transactiondate','$userid','$datetime')"; 
Sign up to request clarification or add additional context in comments.

Comments

0

you're echoing $timestamp3 variable, but in the query I can see $timestamp2!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.