> 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...;-)

Nothing jumps out at me except for the fact that you are using LIKE
without any sort of wildcard in the actual '01' string.  If you don't have
a wildcard of any sort, just use = instead of LIKE

-Rasmus


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to