Hi,

When you run your query, do you get the result back in a variable?

$result = mssql_query($query);

Then, use that result *if* it is successful.


if ( $result )
{
         ## then query was successful
}
else {
        ## query failed.
}

If you do multiple queries, you should use different $result variables, 
like so:

$result1 = mssql_query($query1);
$result2 = mssql_query($query2);
$result3 = mssql_query($query3);
  ...

Not sure if this has anything to do with your problem. I couldn't tell 
if you were doing this with your multiple queries, or not.

Hope it helps some. Good luck,

Nicole Amashta
www.aeontrek.com

Jerome Houston wrote:
> Apologies for the repeat to those who are in php-general and php-db.
> i'm running PHP4.1.1 as a module through Apache 1.3.22 on W2k Server SP2 
> -- connecting to a MSSQL server running on the same OS.
> 
> I'm having 2 problems with the system.
> 1.  on mssql_query(*SELECT statments*); that return MSSQL's 'real' 
> number that have super high precision, php just dies.  no log in the 
> error log - and a "connection with the server was reset" from the browser
> 
> 2.  putting multiple SQL statments into a mssql_query() doesn't return a 
> proper result set, and render other mssql_*() functions non-functional 
> for the rest of the execution of the script.
> 
> explanation of #1:
> 
> <database snippet comment="Inventory column is of type 'real'">
> code    inventory     name
> PRC01   2.33          Prince Brand Chips
> FCA13   9.9999934E-2  Frozen Calamari
> </database snippet>
> 
> when i
> mssql_query("select * from products");
> or, more specifically
> mssql_query("select inventory from products where code = 'FCA13'");
> 
> BOOM!  php crashes, and i get a pop-up window in MSIE that says, "IE 
> cannot open the site ......  the connection with the server was reset"
> 
> but
> mssql_query("select * from products where code = 'PRC01'"); works like a 
> charm.....
> 
> granted 9.9999934E-2 isn't an actual number for inventory, it should be 
> 0.10.  BUT, i can't help that.  my application is not the only one that 
> uses this data.  This happens on various number with extremely high 
> precision (3.4000000E-8, 9.9999938E-3, etc...)
> 
> explanation of #2:
> 
> someone gave me a possible solution to #1: SET TEXTSIZE 2048 before the 
> select.
> but when i do:
> 
> mssql_query("SET TEXTSIZE 2048 select inventory from products where code 
> = 'FCA13'");
> 
> I get:
> 
> Warning: Supplied argument is not a valid MS SQL-result resource in
> utils.php on line 50
> 
> AND, from then on, no mssql_*() functions work....
> 
> Warning: MS SQL: Unable to select database: PRODDB in utils.php on line 48
> 
> Warning: MS SQL: Query failed in utils.php on line 50
> 
> Warning: Supplied argument is not a valid MS SQL-result resource in
> testms.php on line 72
> 
> It turns out when i do any query with mutliple statements in it (even if 
> i don't use the result set for something), it causes the same thing.  
> all mssql_*() functions are rendered non-functional. even something that 
> doesn't access data in the DB, like:
> 
> mssql_query("declare @P1 float \n set @P1 = 10.00 \n select @P1");
> 
> i get the "not a valid MS SQL-result resource" error.
> 
> is there a setting i can change to make multiple statements OK for PHP?  
> I know the statements run just fine on the SQL server, because i ran 
> MSSQL Profiler on the server to catch all statments and errors, and no 
> errors happened..... but all of the mssql*() calls that come after don't 
> even make it to the SQL server.
> 
> Thanks for reading a long email, and any help that can be given.
> 
> jerome
> 
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to