1

In MySQL using phpMyAdmin I am trying out this simple query to fetch rows that satisfy a certain date criteria:

select * 
from student_invoice
where date_generated < '2012-01-01'

The date_generated is of date type. I get an error in phpMyAdmin that says:

ERROR: Unclosed quote @ 64 STR: '

I have closed all quotes so its not making sense. The phpMyAdmin version is 2.11.9.6

3
  • Clearly, this isn't your real query. I can tell by the fake sounding table and column names. I have a feeling there is something else going on that we're not seeing. Can you paste your real query? Commented Nov 8, 2012 at 0:50
  • @dr_rk can you post including the php code? Commented Nov 8, 2012 at 0:54
  • I am doing this frm phpMyAdmin and would like to have it working from here. Commented Nov 8, 2012 at 0:55

4 Answers 4

2

Adding a new answer, as it's unrelated to my other one.

According to this bugzilla post here, your version suffers from this bug!

Upgrading to 2.11.11 or higher should fix this issue.

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

Comments

1

This may sound silly, but have you tried wrapping the date in double quotes?

SELECT * 
FROM sometable
WHERE somedatecolumn < "2012-01-01"

5 Comments

Yup this was the first thing I tried. I get ERROR: Unclosed quote @ 64 STR: "
Very strange. Is this a recent issue? Have you done date range checks successfully in the past? You might want to try updating your phpMyAdmin installation if possible.
I must have at some point surely, but as I normally code in C++ I come back to php for web stuff occasionally. It is weird that this isnt working
What version of phpMyAdmin are you currently running?
I have put the version in my question. For some reason the version wont appear here in the comment,
0

Make sure that those are actually single quotes surrounding the date, not backticks.

1 Comment

I checked that. It is all single quotes
0

Not familiar with the specific error. But you could try casting your static date to a date format, just to make sure it jives with the datecolumn format. Or even casting both? I.e:

  where cast(somedatecolumn as DATE) < cast('2012-01-01' as DATE)

I have a feeling that won't work though. So maybe this?:

  where somedatecolumn < cast('2012-01-01' as DATE)

1 Comment

Nah. That's not necessary in MySQL. This isn't his problem.

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.