php-windows Digest 15 May 2002 09:24:26 -0000 Issue 1145

Topics (messages 13769 through 13778):

MSSQL2000 'real' data type and multiple SQL statments in one mssql_query()
        13769 by: Jerome Houston
        13771 by: Nicole Amashta
        13772 by: Jerome Houston

skipping # sign
        13770 by: Afan Pasalic

A Request about PHP Manual
        13773 by: theN
        13774 by: Christopher Kwasneski
        13778 by: Svensson, B.A.T. (HKG)

query string / variable problem
        13775 by: steve.mediadome.net
        13777 by: Tomator

Re: php_gd.dll and Windows XP
        13776 by: Alan Hale

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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
> 


--- End Message ---
--- Begin Message ---
thanks for the reply to problem #2-

i actually already do check for result validity, but maybe i should have 
said that a part of my problem is that i'm not getting a valid result set 
back even though there should be one.  and in those cases where i do 
multiple statements in one call to mssql_query(), only the *last* statement 
is a select statment that would return a result set.  Usually if i'm doing 
more that one statement in one mssql_query(), it's because i'm declaring a 
couple of variables, calling a stored_proc, then 'select'ing the results of 
the stored_proc.

jerome

>From: Nicole Amashta <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [PHP-WIN] Re: MSSQL2000 'real' data type and multiple SQL 
>statments in one mssql_query()
>Date: Tue, 14 May 2002 16:54:01 -0400
>
>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


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

--- End Message ---
--- Begin Message ---
Hi people!
How can I skip # in text? Inserting text with # sign in database give me just part 
before #. Part after is lost. Slash doesn't work.

Any idea?


Afan
--- End Message ---
--- Begin Message ---
This is just a request. Could some one kindly make the PHP manual more 
suitable for Newbies too. It's a bit hard to understand, particularly 
for concepts that require prior understanding of programming. If some 
one could make any suggestions on this matter I would be very grateful
-- 
Lots of Luck

theN
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
In what ways do you mean make it more suitable for newbies?  I did know a 
few languages before learning PHP, but the manual didn't seem to be too 
complicated for someone just coming into it.

Any questions I did have on the language and how to use it, were fielded 
nicely by either the manual, the user comments under the manual, or the PHP 
lists.

-Chris

At 04:09 AM 5/15/02 +0530, theN wrote:
>This is just a request. Could some one kindly make the PHP manual more 
>suitable for Newbies too. It's a bit hard to understand, particularly for 
>concepts that require prior understanding of programming. If some one 
>could make any suggestions on this matter I would be very grateful
>--
>Lots of Luck
>
>theN
>[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
> This is just a request. Could some one kindly make the PHP manual more 
> suitable for Newbies too. It's a bit hard to understand, particularly 
> for concepts that require prior understanding of programming. If some 
> one could make any suggestions on this matter I would be very grateful
> -- 
> Lots of Luck

In my opinion the manual just follows the standard way a programmer would
like to have the syntax described - on the other hand I am totally brain
washed reading syntax descriptions so I might not be representing newbies
in this matter. But the point I would like to make is (without meaning any
harm or trying to be harsh): try to get used with it, because this is the
way more or less any documentation about syntax specifications looks like.

it is in fact one of the very best I seen - lots of examples (especially is
experience with failures documented which is very important!).

Secondly the online manuals intention is not to teach programming - that
has been fairly well "documented" elsewhere and there are a number of
books available on this topic - but to describe the core PHP functionality.

>From that perspective I can understand that you find the online manual
tricky to handle - but on the other hand PHP is about programming in the
first place, isn't? So it more or less assumed you have done your "home
work" before you consult the PHP online manual.

Anyhow.

Once one master the basic programming principles (sequence, selection
and iteration) and have an understanding of modular programming the
rest follows more or less automatically, and you will find your self
looking for information exactly found in the manual pages.

I am sorry, what I write here might not help you right now, but maybe
you understand the intention of the online manual a little bit better
and maybe you might be able to accept it format as it is, because
believe me or not - the PHP online manual is really splendid and
superb. I don't use PHP my self (yet), but whenever the day comes
that I need to use PHP, I know were to go to get the information
I really need.

Best regards,

                //Anders
--- End Message ---
--- Begin Message ---
I've installed windows binary version of PHP version 4.2.0 running under
Apache as a SAPI module.

I'm having problems when i'm trying to pass variables between scripts and
wonder if this is a configuration issue.  I've  included details below -

a link in a file main.php
<a href='download.php?id=$data->id_files'>Download</a>

passes an id variable pulled from a database.  this works correctly because
when clicked the address bar then displays the query string variable -

/blob/download.php?id=1

however in my download.php script a test for a value in the variable
$id_files fails despite this having been set.

if ($id_files) {

I've had a similar problem with another script which opens a pop-up window
to display a full size version of an image -

javascript:photo_open('photo_display.php?photo=".trim($photos[$i])."',

code in the new window fails to detect any value for the variable photo.

Thanks,

Steve




--- End Message ---
--- Begin Message ---
> /blob/download.php?id=1
...

> if ($id_files) {

As you can see in your example, variable names "$id" and "$id_files" are
different. Try this:
if ($id) {
becouse variable name given in URI is "$id", not "$id_file".



--- End Message ---
--- Begin Message ---
I think this problem has been to do with configuration of the server rather
than PHP as such - phpinfo() was showing the extensions as installed.

I've  downloaded the 4.2.1 Windows installer and run this. I also downloaded
the 4.2.1 zip file (which includes the extenion modules) and copied these
out. Edited php.ini. Now extensions work  fine. But....

I'm now getting "undefined variable" errors from my scripts, which I've
never seen before.

Alan


----- Original Message -----
From: "Jeff Waldock" <[EMAIL PROTECTED]>
To: "'Alan Hale'" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 10:23 PM
Subject: RE: [PHP-WIN] php_gd.dll and Windows XP


> Alan
>
> OK - Have you tried installing the new PHP 4.2.1 that has just been
> released?  I note from the set of files included that this now does have
> a php_gd.dll included.
>
> Jeff
> |-----Original Message-----
> |From: Alan Hale [mailto:[EMAIL PROTECTED]]
> |Sent: 14 May 2002 19:46
> |To: [EMAIL PROTECTED]
> |Subject: Re: [PHP-WIN] php_gd.dll and Windows XP
> |
> |
> |Thanks Jeff, but that's not it - php_gd2.dll did not come with
> |the installation (I did in fact try downloading a copy into my
> |extensions dir, and editing php.ini accordingly, but this
> |worked no better).
> |
> |
> |----- Original Message -----
> |From: "Jeff Waldock" <[EMAIL PROTECTED]>
> |To: "'Alan Hale'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> |Sent: Monday, May 13, 2002 7:33 PM
> |Subject: RE: [PHP-WIN] php_gd.dll and Windows XP
> |
> |
> |> Alan
> |> I think the dll has been re-named to php_gd2.dll.  Just rename the
> |> extension in your php.ini to this and re-start the web
> |server and you
> |> should find it works. Jeff
> |>
> |> |-----Original Message-----
> |> |From: Alan Hale [mailto:[EMAIL PROTECTED]]
> |> |Sent: 13 May 2002 18:24
> |> |To: [EMAIL PROTECTED]
> |> |Subject: [PHP-WIN] php_gd.dll and Windows XP
> |> |
> |> |
> |> |I've recently upgraded to XP Pro from Windows Me. I previously had
> |> |PHP running with the gd extension on Omnihttpd server, but
> |found with
> |> |the same configuration gd would not work (Error
> |> |messages: First: " The procedure entry point add_assoc_long
> |could not
> |> |be located in the dll php4ts.dll" Then: "Unable to locate dll
> |> |'c:\httpd\php\php_gd.dll' - the specified procedure could not be
> |> |found".
> |> |
> |> |I've also tried installing with Easywindows on IIS - again, gd does
> |> |not work (though no helpful error messages).
> |> |
> |> |So I'm coming to the conclusion there some incompatability
> |between XP
> |> |and the php_gd.dll. Does anyone have this working on XP? Can anyone
> |> |suggest how I can fix this?
> |> |
> |> |Many thanks
> |> |
> |> |Alan Hale
> |> |
> |> |
> |>
> |
> |
> |--
> |PHP Windows Mailing List (http://www.php.net/)
> |To unsubscribe, visit: http://www.php.net/unsub.php
> |
>

--- End Message ---

Reply via email to