I'm trying to build a simple sql statement:
// build sql statement
$sql = "select * from some_tbl where ";
if(strlen($mydetails['city']) > 0) {
$sql .= "cityname in (".$mydetails['city'].") and ";
}
$sql .= 'fromdate <= expirydate and expirydate >= curdate() order by rand()';
But $sql is missing everything between < and >. The debugger shows the value of $sql as:
select * from tbl_adsinfo where fromdate = curdate() order by rand()
This is so basic I'm just lost. I don't think that < or > are special characters right? I've tried escaping them and using double quotes instead and it's the same.
What's up here?
> ... <instead), or perhaps replacing them with the</>entities and see if that helps.strip_tagson your sql statement?