0

I'm using the following query:

$sql = "SELECT regTime FROM customers WHERE 'regTime' BETWEEN '2016-04-14 00:00:00' AND '2016-04-16 23:59:59'";

and the result i get is empty array.

what can be the solution ? and why it's happening ? Thanks.

2 Answers 2

3
WHERE 'regTime' 

If you have to quote column names, use backticks (`).... simple single quotes (') indicate a string literal.... so you're trying to check if the string 'regdate' is between dates, not the column value

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

2 Comments

"If you have to quote" , you should include an explanation when he have to use quote them.
to change it also in the dates ? i changed it everywhere still returns empty
0

SELECT [originalAlarmTime] FROM [dbo].[Alarms] WHERE originalAlarmTime BETWEEN '2015-07-01 20:18:58.000' AND '2015-07-01 20:20:47.000'

SELECT [originalAlarmTime] FROM [dbo].[Alarms] WHERE originalAlarmTime >= '2015-07-01 20:18:58.000' AND originalAlarmTime <= '2015-07-01 20:20:47.000'

Comments

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.