hello i have mysql select. i’m going to select loc from core. This loc must select from rows which has dateid=(‘”.$dateid.”‘) and location=(‘”.$id.”‘) also i need to add two condition in WHERE. I mean can i do this like a WHERE dateid=(‘”.$dateid.”‘) AND location=(‘”.$id.”‘) AND BETWEEN ‘2012-10-1’ AND ‘2012-10-4′” this is not working.
how can i add this time span?
$SQL = "SELECT loc FROM core WHERE dateid=('".$dateid."') AND location=('".$id."')";
$result = mysql_query($SQL);
if($result){
$db_field = mysql_fetch_array($result);
$rs[$i]=$db_field[$select[$i]];}
}
can i add start date and end date in where?
how can i do this?
Just remove the braces in first two and add remaining two filters with
ANDoperator. You should be good i.e.I am assuming
dateidandidare numeric fields whilestartdateandenddateare string values containing date values e.g.12/12/2012.Please use the right column and variable names. Also provide to date format of your string.