Re: Another PHP/SQL Query Question...

From: Date: Mon, 17 Jun 2002 18:24:01 +0000
Subject: Re: Another PHP/SQL Query Question...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102554@lists.php.net to get a copy of this message
How are you generating your query string? It looks as though your array value is not set or is not being properly added to your query string. YOu may want to try echoing your query string before executing it to verify that it is properly formated. Just a thought... ----- Original Message ----- From: "Michael" <michaeln@twentyten.org> To: <php-general@lists.php.net> Sent: Monday, June 17, 2002 1:28 PM Subject: [PHP] Another PHP/SQL Query Question... > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#102554) next »