Code bombs connecting to MSSQL 7
| From: | John A DAVIS | Date: | Fri, 06 Apr 2001 20:30:48 +0000 |
| Subject: | Code bombs connecting to MSSQL 7 | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8326@lists.php.net to get a copy of this message | ||
THE SQL STATEMENT:
$data = odbc_do($connection, "Select Distinct [ActivityStatus], [WaterSystemStateCode],
[WaterSystemName], [PopulationServed], [SeasonBegins], [SeasonEnds], [SystemType], Contact, Phone,
County, Connections, Address, CityStateZip From viewInventory Where
[WaterSystemStateCode]=\"OR4100100\""); <<BOMBS HERE
THE ERROR:
Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name
'OR4100100'., SQL state S0022 in SQLExecDirect in C:/Program Files/Apache13
14/Apache/htdocs/sdwis/inventry.php3 on line 21
VERIFICATION:
the field value "OR4100100" exists in the table TINWSYS in the "Number0"
column(alias: "WaterSystemStateCode"). The same query works in Access linked to the MSSQL
7 server. . .
THIS WORKS:
$data = odbc_do($connection,"Select * From viewInventory");