RE: [PHP-WIN] Help with ODBC to Access query

From: Date: Tue, 06 Mar 2001 14:11:03 +0000
Subject: RE: [PHP-WIN] Help with ODBC to Access query
Groups: php.windows 
Request: Send a blank email to php-windows+get-5852@lists.php.net to get a copy of this message
I guess I'd suggest breaking it down in to more digestible parts and find your problems... e.g. try #1 $query1 = 'SELECT COUNT(RunNumber) AS RunCount, > DatePart("m", CallDate) AS MonNum > FROM CallData'; try #2 $query1 = 'SELECT COUNT(RunNumber) AS RunCount, > DatePart("m", CallDate) AS MonNum > FROM CallData > WHERE (CallDate Between #1/1/00# AND #12/31/00#)'; etc.... this will help you pinpoint your problem As a note, I'm not so sure you need the () around your between statement --------------------- John Asendorf - jasendorf@lcounty.com Web Applications Developer http://www.lcounty.com - NEW FEATURES ADDED DAILY! Licking County, Ohio, USA 740-349-3631 Aut insanit homo, aut versus facit > -----Original Message----- > From: S. William Schulz [mailto:sws@astrum.com] > Sent: Monday, March 05, 2001 3:06 PM > To: php-windows@lists.php.net > Subject: [PHP-WIN] Help with ODBC to Access query > > > Hello, > > I'm trying to get the following query to work: > > $query1 = 'SELECT COUNT(RunNumber) AS RunCount, > DatePart("m", CallDate) AS MonNum > FROM CallData > WHERE (CallDate Between #1/1/00# AND #12/31/00#) > AND Driver = 1731 > GROUP BY DatePart("m", CallDate)'; > > It returns the following error: > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few > parameters. Expected 1., SQL state 07001 in SQLExecDirect in > d:\internet\apache\htdocs\db\test.php on line 48 > > Line 48 is : $result = odbc_exec($connect, $query1); > > The connection is established okay, as other queries work: > > > $query2 = "SELECT RunNumber, CallDate AS TDate, > CallUnit, CallDutyCrew > AS Crew, PtNum, NatureFull, Driver, Attendant1, Attendant2 > FROM CallData > WHERE (CallDate Between #1/1/00# AND #12/31/00#) > AND Attendant1 = $id > ORDER BY RunNumber"; > > I've tried escaping the m's in the DatePart (I initially used > double-quotes > " " around the query string), tried changing the COUNT(RunNumber) to > COUNT(*), etc without success. The query runs fine as > written if entered > directly into Access. > > Any ideas? > > SWS > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#5852) next »