MSSQL/PHP Query Help
| From: | Michael | Date: | Wed, 12 Jun 2002 14:56:21 +0000 |
| Subject: | MSSQL/PHP Query Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101743@lists.php.net to get a copy of this message | ||
Hey guys... I'm currently using PHP, FreeTDS, and Sybase libraries to
access a database on an MS SQL 2000 server. Things are going fine, except
for my more complex queries. Here is an example:
SELECT Servers.Name, Nics.MAC
FROM Servers INNER JOIN Nics ON Servers.ServerId = Nics.Server
WHERE (((Nics.MAC)="0002B34DA81F")) OR (((Nics.MAC)="0002B34DA76F")) OR
(((Nics.MAC)="0002B34DA32D")) OR (((Nics.MAC)="0002B34DA31D"));
This query isn't even as bad as it's going to get, but I get the error:
"Sybase error: Invalid column name '0002B34DA81F'."
I get this for each Nics.MAC entry that I make. If I don't include the
"WHERE/OR" statement, the query runs fine. The query runs correctly on the
MS SQL server itself, but I can't get it to work here.
I assume that PHP just passes the query to the SQL server directly, so there
must be something that I'm missing. Do I need to escape more than just the
quotes? If there is anything I need to know about PHP and MS SQL before I
go on, I'd love to hear it. ;-)
Michael