query problem

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: query problem
Groups: php.db 
Request: Send a blank email to php-db+get-8885@lists.php.net to get a copy of this message
Hi all: I'm using mysql-3.22.32: My PHP-embedded query is as follows: else if($sortBy == '01') { $sql = "SELECT * FROM $table_cal WHERE item_activity='$id' AND DATE_FORMAT('item_date','%m') LIKE '$sortBy'"; $sortBy = "Month of January"; } * '$sortBy' is equal to '01'. * MySQL isn't complaining about any of the query. * DATE_FORMAT('item_date','%m') should be '01' (taken from a 'date' column in YYYY-MM-DD fromat. Can anyone tell me what is wrong with this query (I may have missed something - but then that shouldn't surprise as I've been staring at it for 3 hours...;-) Cheers: Russ #-------------------------------------------------------# "Believe nothing - consider everything" "Web Developers do it on-the-fly." Russ Michell Anglia Polytechnic University Webteam e: r.j.michell@apu.ac.uk w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #-------------------------------------------------------#

« previous php.db (#8885) next »