0

i have a table where i am storing my expiry date like thi:

| id |   expire_date    |
| 2  | 2019-09-19T15:34 |

and i want to query the table with todays date and time and onwards so far this is what i got;

date_default_timezone_set("Pacific/Fiji");
$now = date('Y-m-d\TH:i');
"SELECT * FROM `table` WHERE $now > `expire_date`"

but this does not work .

the is not a sql injection problem.

6563cc10d2
  • 193
  • 1
  • 2
  • 8

1 Answers1

1

You need to add column name after the WHERE clause not after greater than symbol >

"SELECT * FROM table WHERE expire_date >= '$now'"

For the reference you can visit here

Zain Farooq
  • 2,956
  • 3
  • 20
  • 42