RE: [PHP] MSSQL/PHP Query Help
| From: | NCI/IMS) | Date: | Wed, 12 Jun 2002 14:58:39 +0000 |
| Subject: | RE: [PHP] MSSQL/PHP Query Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101744@lists.php.net to get a copy of this message | ||
have you tried Nics.MAC in ("xxx","xxx","xxx","xxx")?
There's a lot less
room for error in that, because it's so much tidier.
-Natalie
-----Original Message-----
From: Michael [mailto:php@twentyten.org]
Sent: Wednesday, June 12, 2002 10:56 AM
To: PHP-General@lists.php.net
Subject: [PHP] MSSQL/PHP Query Help
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php