Posted under » PHP » MySQL on 08 June 2009
sample SQL query.
"select * from newevents where eventstarttime > '2012-03-24' AND eventstarttime < '2012-05-24'"
You can make it more customisable by
"select * from newevents where eventstarttime > '2012-03-24' AND eventstarttime < '".$hedate."'"
PHP is forgiving with variables. You can also do this
"SELECT dvdtag.aid AS aids, dvdtag.did, director.name AS dir, dvd.name AS title FROM dvdtag INNER JOIN director ON dvdtag.aid=director.aid WHERE dvdtag.aid = $p ORDER by title"
You can see that there variable $p is added without encoding.
See also Sample SQL query select and join.