1

I have a transaction procedure like this:

  INSERT INTO transaction(out, taxi_no, driver_name, odometer, date, mileage_out, hours_rent, remittance, total, shortage) VALUES (@out, @taxiNO, @drivername, @odometer, @date, @mout, @hours, @remittance, @total, @shortage)

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'out, taxi_no, driver_name, odometer, date, mileage_out, hours_rent, remittance, ' at line 1

I just copied the syntax and just change the values from my other project, it works well on my other project but when i tried to run the application, it gives me the error.

5
  • 1
    That error does not match the query shown. For example, the error shown displays a odometer field that is not present in the query Commented Mar 6, 2017 at 12:13
  • There is almost no way we can help you at present. The error doesn't match the query, as @Pikoh has just said. Where is the out part before the taxi_no? Where is odometer? I feel like this is either the wrong error message that you've given us, or it's not this query throwing it. Commented Mar 6, 2017 at 12:17
  • Oh I'm so sorry i copied the wrong line of code. Commented Mar 6, 2017 at 12:22
  • 1
    So you have an column named out in your table? then try changing that line to this INSERT INTO transaction(`out`, taxi_no, driver_name, odometer, date, mileage_out, hours_rent, remittance, total, shortage) VALUES (@out, @taxiNO, @drivername, @odometer, @date, @mout, @hours, @remittance, @total, @shortage) Commented Mar 6, 2017 at 12:24
  • It worked! Thank you so much. Commented Mar 6, 2017 at 12:26

1 Answer 1

3

out is a keyword in mysql so please add backtick ie `back quote`

Sign up to request clarification or add additional context in comments.

1 Comment

oh i see, i didn't knew about it. Thank you so much it worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.