Q: Error: SELECT bookedseat from bookings where sdate=2018-04-26 and stime=5PM Unknown column '5PM' in 'where clause' This is the html form code
And this is the php for the above form.After executing this,I get an error saying " Error: SELECT bookedseat from bookings where sdate=2018-04-26 and stime=5PM
Unknown column '5PM' in 'where clause' "
Why is it?

A: You need to wrap your variables in single quotes.
$query = "SELECT bookedseat from bookings where sdate='$sdate' and stime='$stime'"

PD: As everybody says, this is not the best approach. You need to make a prepared statement instead to avoid sql injection and other type of errors like this
