php-windows Digest 26 May 2004 06:42:19 -0000 Issue 2262

Topics (messages 23829 through 23836):

Re: tgz files
        23829 by: Jason Barnett

MS SQL Query question
        23830 by: Ron.Herhuth.tatumpartners.com
        23831 by: Derrick Hermanson
        23832 by: Gryffyn, Trevor
        23833 by: Ron.Herhuth.tatumpartners.com
        23836 by: Dr. Robert Probst

GTK - why not?
        23834 by: CBQ - GMX.at
        23835 by: Vail, Warren

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 --- I've found an incredibly useful compression utility for windows called 7-zip. It handles zip, tar/gzip, bzip, and a specialized 7-zip utility that can compress even more (by using a larger library). I don't use the 7-zip compression itself all that much, but the utility itself is a nice (and free) application.
--- End Message ---
--- Begin Message ---
When I run a query the syntax looks like this:

$result = mssql_query($query);
$numRows = mssql_num_rows($result);

for($i=0; $i<$numRows; $i++)
{
$row = mssql_fetch_array($result);
}

but if I go to try and loop through the resultset again it wont work
unless I run this line again "$result = mssql_query($query);"

I'm sure this is wasting resources but I can't seem to get around it.  Any
suggestions?

Thanks,
Ron






--- End Message ---
--- Begin Message ---
try something like this

$result = mssql_query ($query);
if ($result) {
        while ($template_args = msssql_fetch_array ($res)) {
                //what ever you want to do with the data
        }
}

Derrick Hermanson
Programmer/Analyst I
Acton International LTD.
402.470.5816
mailto:[EMAIL PROTECTED]


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 25, 2004 1:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] MS SQL Query question



When I run a query the syntax looks like this:

$result = mssql_query($query);
$numRows = mssql_num_rows($result);

for($i=0; $i<$numRows; $i++)
{
$row = mssql_fetch_array($result);
}

but if I go to try and loop through the resultset again it wont work
unless I run this line again "$result = mssql_query($query);"

I'm sure this is wasting resources but I can't seem to get around it.  Any
suggestions?

Thanks,
Ron

--- End Message ---
--- Begin Message ---
What's happening is the pointer on the results is advancing until it
hits the end of the result set.  When you run it again, the pointer is
still at the end of the result set and therefore sees nothing 'ahead' of
it.

The same thing can happen with arrays.  I'm not sure if you have to do
it still, but I habituatlly do a "reset($arr);" after I do a sort on the
array because the sort did (still does?) leave the array pointer at the
end of the array, necessitating a 'reset'.

Read some of the notes here:
http://us4.php.net/mysql_fetch_array

This one in particular should help:
********************************
Ben
06-Apr-2004 09:59 
One of the most common mistakes that people make with this function,
when using it multiple times in one script, is that they forget to use
the mysql_data_seek() function to reset the internal data pointer.

When iterating through an array of MySQL results, e.g.

<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   foreach ($line as $col_value) {
       echo $col_value . '<br />';
   }
}
?>

the internal data pointer for the array is advanced, incrementally,
until there are no more elements left in the array. So, basically, if
you copy/pasted the above code into a script TWICE, the second copy
would not create any output. The reason is because the data pointer has
been advanced to the end of the $line array and returned FALSE upon
doing so.

If, for some reason, you wanted to interate through the array a second
time, perhaps grabbing a different piece of data from the same result
set, you would have to make sure you call

<?php
mysql_data_seek($result, 0);
?>

This function resets the pointer and you can re-iterate through the
$line array, again! 
********************************

-TG


> -----Original Message-----
> From: Derrick Hermanson [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, May 25, 2004 3:05 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] MS SQL Query question
> 
> 
> try something like this
> 
> $result = mssql_query ($query);
> if ($result) {
>       while ($template_args = msssql_fetch_array ($res)) {
>               //what ever you want to do with the data
>       }
> }
> 
> Derrick Hermanson
> Programmer/Analyst I
> Acton International LTD.
> 402.470.5816
> mailto:[EMAIL PROTECTED]
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 25, 2004 1:30 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] MS SQL Query question
> 
> 
> 
> When I run a query the syntax looks like this:
> 
> $result = mssql_query($query);
> $numRows = mssql_num_rows($result);
> 
> for($i=0; $i<$numRows; $i++)
> {
> $row = mssql_fetch_array($result);
> }
> 
> but if I go to try and loop through the resultset again it wont work
> unless I run this line again "$result = mssql_query($query);"
> 
> I'm sure this is wasting resources but I can't seem to get 
> around it.  Any
> suggestions?
> 
> Thanks,
> Ron
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Trevor,

That is the key!!! You rock...cut my page load time in half.

Thanks my good man!

Ron

>From: Gryffyn, Trevor
>To: Derrick Hermanson; Herhuth, Ron; [EMAIL PROTECTED]
>Sent: 05/25/2004 3:11 PM
>What's happening is the pointer on the results is advancing until it
>hits the end of the result set.  When you run it again, the pointer is
>still at the end of the result set and therefore sees nothing 'ahead' of
>it.
>
>The same thing can happen with arrays.  I'm not sure if you have to do
>it still, but I habituatlly do a "reset($arr);" after I do a sort on the
>array because the sort did (still does?) leave the array pointer at the
>end of the array, necessitating a 'reset'.
>
>Read some of the notes here:
>http://us4.php.net/mysql_fetch_array
>
>This one in particular should help:
>********************************
>Ben
>06-Apr-2004 09:59
>One of the most common mistakes that people make with this function,
>when using it multiple times in one script, is that they forget to use
>the mysql_data_seek() function to reset the internal data pointer.
>
>When iterating through an array of MySQL results, e.g.
>
><?php
>while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
>   foreach ($line as $col_value) {
>       echo $col_value . '<br />';
>   }
>}
>?>
>
>the internal data pointer for the array is advanced, incrementally,
>until there are no more elements left in the array. So, basically, if
>you copy/pasted the above code into a script TWICE, the second copy
>would not create any output. The reason is because the data pointer has
>been advanced to the end of the $line array and returned FALSE upon
>doing so.
>
>If, for some reason, you wanted to interate through the array a second
>time, perhaps grabbing a different piece of data from the same result
>set, you would have to make sure you call
>
><?php
>mysql_data_seek($result, 0);
>?>
>
>This function resets the pointer and you can re-iterate through the
>$line array, again!
>********************************
>
>-TG
>
>
>> -----Original Message-----
>> From: Derrick Hermanson [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, May 25, 2004 3:05 PM
>> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>> Subject: RE: [PHP-WIN] MS SQL Query question
>>
>>
>> try something like this
>>
>> $result = mssql_query ($query);
>> if ($result) {
>>      while ($template_args = msssql_fetch_array ($res)) {
>>              //what ever you want to do with the data
>>      }
>> }
>>
>> Derrick Hermanson
>> Programmer/Analyst I
>> Acton International LTD.
>> 402.470.5816
>> mailto:[EMAIL PROTECTED]
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, May 25, 2004 1:30 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP-WIN] MS SQL Query question
>>
>>
>>
>> When I run a query the syntax looks like this:
>>
>> $result = mssql_query($query);
>> $numRows = mssql_num_rows($result);
>>
>> for($i=0; $i<$numRows; $i++)
>> {
>> $row = mssql_fetch_array($result);
>> }
>>
>> but if I go to try and loop through the resultset again it wont work
>> unless I run this line again "$result = mssql_query($query);"
>>
>> I'm sure this is wasting resources but I can't seem to get
>> around it.  Any
>> suggestions?
>>
>> Thanks,
>> Ron
>>
>> -- 
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>







--- End Message ---
--- Begin Message ---
IN  MY (not MS) SQL I would try

mysql_data_seek ($result, 0); 

to move the internal pointer to the first data row
I dont know at the moment if there is a similar function in the msxxxx area.

maybe it helps

robert


> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Gesendet: Dienstag, 25. Mai 2004 20:30
> An: [EMAIL PROTECTED]
> Betreff: [PHP-WIN] MS SQL Query question
> 
> 
> 
> When I run a query the syntax looks like this:
> 
> $result = mssql_query($query);
> $numRows = mssql_num_rows($result);
> 
> for($i=0; $i<$numRows; $i++)
> {
> $row = mssql_fetch_array($result);
> }
> 
> but if I go to try and loop through the resultset again it 
> wont work unless I run this line again "$result = 
> mssql_query($query);"
> 
> I'm sure this is wasting resources but I can't seem to get 
> around it.  Any suggestions?
> 
> Thanks,
> Ron
> 
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
hi @ all

quick question:

ready?

here it is!

WHY IS PHP - GTK not webbased?


sorry, may i am wrong, but i am looking for someone, who is responsable for GTK.
cz, some programmers (including myself) thinking loud about, what could be the reason 
why PHP-GTK is not webbased.

that would be high-end applications.

+ u have nothing to install.
+ all is accessable over the internet and
+ just call it, like page over an http link
+ and the source would be still php.

so here is the main question:

Why not?

Would it be maybe a option in the future, if yes, WHEN ?

thx to everybody, who could send me a little personal feedback and/or telling me 
please, over who i could get some more informations.

PS: sorry about my english, but its d**n late here.

best regards
CBQ

--- End Message ---
--- Begin Message ---
At first the question intrigued me, now I'm not so sure.  What becomes
apparent is a somewhat foggy term "web based".  I assume that you want to
get at the powerful widgets of GTK in your "web based" applications.

First concern is the client machine running a web browser only, which to
keep your machine safe is not allowed to install anything on your machine
without your permission, which means it either lives with the widgets
provided by the browser for html, uses the ones provided by the JRE plug-in
for the browser (and this plug-in only interprets java applet binary), or
each client installs a GTK Plug-in, if there were one, which shoots down
your "nothing to install" goal.

Next concern is the machine running the web server, which with the exception
of a Java App Server, likes to forget about your web browser so it can use
it's resources handle more users, once it's uploaded everything you
requested.  Any code on the server handles database access, and other tasks.
If you look closely you will discover that many of the more powerful widgets
require lots of continual interface as you click open tree leaves, an pull
scroll bars, and show progress bars.  To keep the connection alive to
support this kind of interaction, the web server cannot optimize itself by
forgetting about you and suddenly you have a web server that can only handle
a few concurrent users at a time.  This is why the Java App Server is
designed the way it is, to support this kind of interaction between applets
and servlets, etc.  This is also why you will find that a wide variety of
application on a single server is just not possible on a Java App server,
everything remains persistent in the servers memory so that it can handle
this interaction quickly.  I personally know of a case where a non-Java web
application on a single server was handling the CGI (PHP is sometimes a CGI)
for close to 500 websites, and after that application was converted to Java,
the largest number of sites that could be handled by a single server was 2
(two).

If you really want to get more powerful widgets on your website, you might
check out JavaScript (which isn't even close to Java) and what is being
developed at the following URL.

http://www.blueshoes.org/en/javascript/

I think you will find this interfaces well with your PHP application, or you
could do like so many already have, jump over to Java development.

I don't want to discourage you from thinking "outside the box", and
hopefully this will get you started toward understanding the box.  I
personally prefer PHP because it's the fastest way to put up an application
with a reasonable user load, and most applications only need to be that
powerful.

Hope this helps,

Warren Vail


-----Original Message-----
From: CBQ - GMX.at [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 25, 2004 8:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] GTK - why not?


hi @ all

quick question:

ready?

here it is!

WHY IS PHP - GTK not webbased?


sorry, may i am wrong, but i am looking for someone, who is responsable for
GTK. cz, some programmers (including myself) thinking loud about, what could
be the reason why PHP-GTK is not webbased.

that would be high-end applications.

+ u have nothing to install.
+ all is accessable over the internet and
+ just call it, like page over an http link
+ and the source would be still php.

so here is the main question:

Why not?

Would it be maybe a option in the future, if yes, WHEN ?

thx to everybody, who could send me a little personal feedback and/or
telling me please, over who i could get some more informations.

PS: sorry about my english, but its d**n late here.

best regards
CBQ

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

--- End Message ---

Reply via email to