Another PHP/SQL Query Question...
| From: | Michael | Date: | Mon, 17 Jun 2002 17:28:23 +0000 |
| Subject: | Another PHP/SQL Query Question... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102552@lists.php.net to get a copy of this message | ||
Hey guys, I'm having another SQL issue... I'm currently using PHP, FreeTDS,
and Sybase libraries to
access a database on an MS SQL 2000 server. This is the query I'm trying to
make:
SELECT Servers.Name, ServerProfiles.Name FROM ServerProfiles INNER JOIN
Servers on ServerProfiles.ServerProfileID = Servers.Profile WHERE
(((Servers.Name)='$server[0]'))
The resulting error is as follows:
"Sybase error: Unclosed quotation mark before the character string
'mailserver01'. (severity 15)"
"Sybase error: Line 1: Incorrect syntax near 'mailserver01'. (severity 15)"
The thing is, if I type the query with the server anme instead of the
variable, it works!
SELECT Servers.Name, ServerProfiles.Name FROM ServerProfiles INNER JOIN
Servers on ServerProfiles.ServerProfileID = Servers.Profile WHERE
(((Servers.Name)='mailserver01'))
I printed the query to make sure that it is indeed the same query as above,
and it appears to be. I'm sure I'm missing a little nuance here. Could
someone help me out?
Also, is there a good resource for looking up little nuances such as this?
You know, reminders regarding which characters to escape, which quote types
to use etc. I really feel bad about bugging you guys like this on subjects
that are probably pretty basic. ;-)
Michael