I have written some SQL code that executes without any problems in Query Analyzer, but when I try to use it in my PHP code, it does not return any results. I believe the culprits may be the variable assignment lines since everything else seems to work when I comment them out.
Here is a very simplified example, with the names changed to protect the innocent... er... my job:
[NON-WORKING CODE]
$Database_Query = "
DECLARE @Store VARCHAR(64)
SET @Store = 'Jelly Bean Emporium'
SELECT * FROM Some_Table
";
[/NON-WORKING CODE]
[FULLY-FUNCTIONAL CODE]
$Database_Query = "
DECLARE @Store VARCHAR(64)
/*SET @Store = 'Jelly Bean Emporium'*/
SELECT * FROM Some_Table
";
[/FULLY-FUNCTIONAL CODE]
I am using single-quotes for the store name because they are within double-quotes and escaping them does not seem to work in this context. The table doesn't have to have anything to do with the variable assignment; if the SET line is there--with or without a semi-colon--it breaks. Any ideas what might be causing this and/or how I can fix it?
I am running PHP 4.0.4pl1 on Windows 2000 Server with Microsoft SQL Server 7.0 in case any of that matters.
Thanks in advance for any help!
Here is a very simplified example, with the names changed to protect the innocent... er... my job:
[NON-WORKING CODE]
$Database_Query = "
DECLARE @Store VARCHAR(64)
SET @Store = 'Jelly Bean Emporium'
SELECT * FROM Some_Table
";
[/NON-WORKING CODE]
[FULLY-FUNCTIONAL CODE]
$Database_Query = "
DECLARE @Store VARCHAR(64)
/*SET @Store = 'Jelly Bean Emporium'*/
SELECT * FROM Some_Table
";
[/FULLY-FUNCTIONAL CODE]
I am using single-quotes for the store name because they are within double-quotes and escaping them does not seem to work in this context. The table doesn't have to have anything to do with the variable assignment; if the SET line is there--with or without a semi-colon--it breaks. Any ideas what might be causing this and/or how I can fix it?
I am running PHP 4.0.4pl1 on Windows 2000 Server with Microsoft SQL Server 7.0 in case any of that matters.
Thanks in advance for any help!