Re: Re: repeating data from one column until data from anothercolumn changes

From: Date: Tue, 04 May 2004 21:25:23 +0000
Subject: Re: Re: repeating data from one column until data from anothercolumn changes
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-185353@lists.php.net to get a copy of this message
"Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message news:40980736.4030707@webglobe.sk... > msa wrote: > > My date format is as above....I am getting the following error message: > > > > You have an error in your SQL syntax. Check the manual that corresponds to > > your MySQL server version for the right syntax to use near 'Y') . ' AND > > MONTH(date) = ' . date('m') . ' ORDER BY sort DESC' > > > > > > I changed your code to fit my table name and "sort" to be lower case, as it > > is in the database: > > > > "SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') . ' > > AND > > MONTH(date) =' . date('m') . ' ORDER BY sort DESC"; > > > > any ideas? > > > > thanks again!! > > > > date('m') was not parsed by php as it was in the string. Syntax > highlighting would help you see it. Try: > > "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . > "' AND > MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; Hi Marek, just tested it in phpMyAdmin: you don't need single quotes around the two date values and therefore don't need double quotes around the whole string - using single quotes around the string makes parsing the string faster (at least that's what I frequently read about single vs. double quotes). Regards, Torsten

« previous php.general (#185353) next »