Fwd: RE: Re[2]: [PHP-WIN] php access query problem

From: Date: Mon, 12 Feb 2001 00:20:03 +0000
Subject: Fwd: RE: Re[2]: [PHP-WIN] php access query problem
Groups: php.windows 
Request: Send a blank email to php-windows+get-5508@lists.php.net to get a copy of this message
Date: Sun, 11 Feb 2001 10:02:56 -0500 To: php-windows-help@lists.php.net From: Bob Hall <rjhalljr@starpower.net> Subject: RE: Re[2]: [PHP-WIN] php access query problem Cc: Bcc: X-Attachments:
I have the query $cur= odbc_exec( $cnx, "SELECT Location, 'Dept ID', 'Equip Type' FROM Equipment01 WHERE Location = '415C'");
Sir, you have the second and third items in your SELECT clause in quotes, so the the SELECT statement will return the literal strings 'Dept ID' and 'Equip Type', rather than column values.
which returns the proper results but when I add AND 'Equip Type' =
'C' to
the end of it I get no results. Is my syntax correct? Thanks, Aaron
$cur= odbc_exec( $cnx, "SELECT Location, 'Dept ID', 'Equip Type' FROM Equipment01 WHERE Location = '415C' AND 'Equip Type' = 'C'");
In your WHERE clause, you are comparing the literal string 'Equip Type' with the literal string 'C'. Since they are not the same, the WHERE clause always returns FALSE, and no rows are selected. Don't put your column names in quotes. That forces the DBMS to evaluate them as literal strings, rather than as column names. Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak


« previous php.windows (#5508) next »