MySQL query cache and PHP variables
Posted
by Saif Bechan
on Stack Overflow
See other posts from Stack Overflow
or by Saif Bechan
Published on 2010-04-06T21:37:29Z
Indexed on
2010/04/06
21:43 UTC
Read the original article
Hit count: 385
I have seen the following statement made about the query cache:
// query cache does NOT work
$r = mysql_query("SELECT username FROM user WHERE signup_date >= CURDATE()");
// query cache works!
$today = date("Y-m-d");
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '$today'");
So the query cache only works on the second query.
I was wondering if the query cache will also work on this:
define('__TODAY',date("Y-m-d"));
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '".__TODAY."'");
© Stack Overflow or respective owner