php-windows Digest 7 May 2002 13:28:28 -0000 Issue 1132

Topics (messages 13581 through 13590):

Re: Shutting down Apache on Windows
        13581 by: Brad Thomas

Re: Download monitor
        13582 by: Webmaster

results over multiple pages
        13583 by: RS Herhuth
        13584 by: Hugh Bothwell
        13585 by: Matt Parlane
        13586 by: olinux
        13587 by: Rasmus Lerdorf

Session + IIS
        13588 by: Maurice

Re: Can you use file() and rtrim() together
        13589 by: blulagoon

stuck between operating systems & web servers ! ! ! !
        13590 by: toby z

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 ---
Hello.
To shut down apache, you need to make the apache window active, and press
the Ctrl + C keys.

Hope this helps.

Brad

"Jerry" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello! I just setup Apache 1.3 on Win98 using Triad. Everything
> works great. I am running Apache and need to know how to shut it
> down properly. I can't find any instructions on this in the
> documentation. There is a DOS window open that does not allow me
> type anything. How should I do it?
>
> TIA,
> Jerry


--- End Message ---
--- Begin Message ---
You can find several download data bases at websites offering free scripts.
Most are MySql and/or other database driven...

(example: http://www.phparena.net/ )

Webmaster



"Olivier Hubert" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is probably a topic for gurus.
>
> I'd like to have some way of knowing, with PHP, when a download is
> finished. My site offers several files for download, and I want to make
> sure a given user does not download more than one file at a time. I know
> there is a way to do this with an Apache module, but I'm using Apache for
> Windows and I really don't feel like writing my own module for connection
> management.
>
> Users are people with sessions, so I have access to session vars and since
> I use a database I also have acces to MySQL tables.
>
> The configuration I use is as follow:
>
> - Apache 1.3.22
> - PHP 4.1.1
> - MySQL 3.23 something
>
> Again, my goal is to be able to tell when a given user has finished a
> download so I can give him permission to start another one. This could be
> done in anything, PHP, javascript, Java, I don't really care.
>
> Any help appreciated.
>
> Olivier Hubert
>


--- End Message ---
--- Begin Message ---
List,

I'm pulling my hair out trying to figure out why this is not working.  I am
trying to limit the number of returns on a page and if need be spread the
results over multiple pages.  The following is where i believe the problem
to be.  Please keep in mind I'm using Microsoft SQL Server.  The variables
are being set properly (I have several places where I'm echoing the results
just to be sure).  The problem is that the same five names are being
returned on each page even though the value of $i is incrementing properly
and the correct number of pages are being calculated correctly.




if ($currentPage > 1) {
                $host="localhost";
                $DB="testDB";
                $user="sa";
                $pass="";
                $connect = mssql_connect($host,$user,$pass) or die ($host." not
accessible.");
                if ($DB) mssql_select_db($DB)or die('USE '.$DB.' failed!');
                $query = "SELECT first_name, last_name FROM individual WHERE last_name
LIKE '$searchField%' ORDER by last_name ASC";
                $result = mssql_query($query);
                $numRows = mssql_num_rows($result);
                $numPages = ceil($numRows/$numDisplay);
                echo "Total Rows: $numRows, Results per Page: $numDisplay, Number of
Pages: $numPages<br><br>";
                $lwr = $currentPage * $numDisplay;
                $upr = ($currentPage * $numDisplay) + $numDisplay;
                echo "$lwr, $upr <br><br>";
                echo "Current Page: $currentPage<br><br>";
                for($i = $lwr; $i < $upr; $i++){
                        $row = mssql_fetch_row($i,$result);
                        echo "$i, $row[first_name] $row[last_name]<br />";
                }

                if($currentPage < $numPages){
                $nextPage = $currentPage + 1;
                        echo "<a
href='searchScreen.php?searchField=$searchField&currentPage=$nextPage'>next<
/a>";
                }
}






Anyone have any idea why only the same five names might be being returned on
each of the pages?  I'm not getting something here.

Thanks,
Ron

--- End Message ---
--- Begin Message ---

> if ($currentPage > 1) {
> $host="localhost";
> $DB="testDB";
> $user="sa";
> $pass="";

Umm... if that's the only place you use these values,
why not specify them inline?  Easier to read, for sure.

> $connect = mssql_connect($host,$user,$pass) or die ($host." not
> accessible.");
> if ($DB) mssql_select_db($DB)or die('USE '.$DB.' failed!');
> $query = "SELECT first_name, last_name FROM individual WHERE last_name
> LIKE '$searchField%' ORDER by last_name ASC";

Surely LIMIT would be a better way to do this?



--- End Message ---
--- Begin Message ---
I don't think SQL Server supports the LIMIT statement  (this isn't MySQL
remember...)
>From memory SQL Server uses the TOP statement - something like
"SELECT TOP 5 <rest of SQL statement here...>" although I'm probably wildly
off as far as syntax goes.
You can also use a percentage for the number of rows you want.

Hope that helps...

Matt

"Hugh Bothwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > if ($currentPage > 1) {
> > $host="localhost";
> > $DB="testDB";
> > $user="sa";
> > $pass="";
>
> Umm... if that's the only place you use these values,
> why not specify them inline?  Easier to read, for sure.
>
> > $connect = mssql_connect($host,$user,$pass) or die ($host." not
> > accessible.");
> > if ($DB) mssql_select_db($DB)or die('USE '.$DB.' failed!');
> > $query = "SELECT first_name, last_name FROM individual WHERE last_name
> > LIKE '$searchField%' ORDER by last_name ASC";
>
> Surely LIMIT would be a better way to do this?
>
>
>


--- End Message ---
--- Begin Message ---
Does MSSQL not have a LIMIT clause?

$offset = ($page - 1) * $numDisplay
i.e. SELECT * FROM $table WHERE whatever = '$blah'
LIMIT $offset, $numDispay

olinux

--- RS Herhuth <[EMAIL PROTECTED]> wrote:
> List,
> 
> I'm pulling my hair out trying to figure out why
> this is not working.  I am
> trying to limit the number of returns on a page and
> if need be spread the
> results over multiple pages.  The following is where
> i believe the problem
> to be.  Please keep in mind I'm using Microsoft SQL
> Server.  The variables
> are being set properly (I have several places where
> I'm echoing the results
> just to be sure).  The problem is that the same five
> names are being
> returned on each page even though the value of $i is
> incrementing properly
> and the correct number of pages are being calculated
> correctly.
> 
> 
> 
> 
> if ($currentPage > 1) {
>               $host="localhost";
>               $DB="testDB";
>               $user="sa";
>               $pass="";
>               $connect = mssql_connect($host,$user,$pass) or die
> ($host." not
> accessible.");
>               if ($DB) mssql_select_db($DB)or die('USE '.$DB.'
> failed!');
>               $query = "SELECT first_name, last_name FROM
> individual WHERE last_name
> LIKE '$searchField%' ORDER by last_name ASC";
>               $result = mssql_query($query);
>               $numRows = mssql_num_rows($result);
>               $numPages = ceil($numRows/$numDisplay);
>               echo "Total Rows: $numRows, Results per Page:
> $numDisplay, Number of
> Pages: $numPages<br><br>";
>               $lwr = $currentPage * $numDisplay;
>               $upr = ($currentPage * $numDisplay) + $numDisplay;
>               echo "$lwr, $upr <br><br>";
>               echo "Current Page: $currentPage<br><br>";
>               for($i = $lwr; $i < $upr; $i++){
>                       $row = mssql_fetch_row($i,$result);
>                       echo "$i, $row[first_name] $row[last_name]<br
> />";
>               }
> 
>               if($currentPage < $numPages){
>               $nextPage = $currentPage + 1;
>                       echo "<a
>
href='searchScreen.php?searchField=$searchField&currentPage=$nextPage'>next<
> /a>";
>               }
> }
> 
> 
> 
> 
> 
> 
> Anyone have any idea why only the same five names
> might be being returned on
> each of the pages?  I'm not getting something here.
> 
> Thanks,
> Ron
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
--- End Message ---
--- Begin Message ---
heh ;)

I'd love it if it did.  But alas, LIMIT is actually a hack I came up with
years ago for mSQL which was brought into MySQL and enhanced.  If it ever
makes it into MSSQL or Oracle I'll charge big-time royalties or
something...

-Rasmus

On Mon, 6 May 2002, olinux wrote:

> Does MSSQL not have a LIMIT clause?
>
> $offset = ($page - 1) * $numDisplay
> i.e. SELECT * FROM $table WHERE whatever = '$blah'
> LIMIT $offset, $numDispay
>
> olinux
>
> --- RS Herhuth <[EMAIL PROTECTED]> wrote:
> > List,
> >
> > I'm pulling my hair out trying to figure out why
> > this is not working.  I am
> > trying to limit the number of returns on a page and
> > if need be spread the
> > results over multiple pages.  The following is where
> > i believe the problem
> > to be.  Please keep in mind I'm using Microsoft SQL
> > Server.  The variables
> > are being set properly (I have several places where
> > I'm echoing the results
> > just to be sure).  The problem is that the same five
> > names are being
> > returned on each page even though the value of $i is
> > incrementing properly
> > and the correct number of pages are being calculated
> > correctly.
> >
> >
> >
> >
> > if ($currentPage > 1) {
> >             $host="localhost";
> >             $DB="testDB";
> >             $user="sa";
> >             $pass="";
> >             $connect = mssql_connect($host,$user,$pass) or die
> > ($host." not
> > accessible.");
> >             if ($DB) mssql_select_db($DB)or die('USE '.$DB.'
> > failed!');
> >             $query = "SELECT first_name, last_name FROM
> > individual WHERE last_name
> > LIKE '$searchField%' ORDER by last_name ASC";
> >             $result = mssql_query($query);
> >             $numRows = mssql_num_rows($result);
> >             $numPages = ceil($numRows/$numDisplay);
> >             echo "Total Rows: $numRows, Results per Page:
> > $numDisplay, Number of
> > Pages: $numPages<br><br>";
> >             $lwr = $currentPage * $numDisplay;
> >             $upr = ($currentPage * $numDisplay) + $numDisplay;
> >             echo "$lwr, $upr <br><br>";
> >             echo "Current Page: $currentPage<br><br>";
> >             for($i = $lwr; $i < $upr; $i++){
> >                     $row = mssql_fetch_row($i,$result);
> >                     echo "$i, $row[first_name] $row[last_name]<br
> > />";
> >             }
> >
> >             if($currentPage < $numPages){
> >             $nextPage = $currentPage + 1;
> >                     echo "<a
> >
> href='searchScreen.php?searchField=$searchField&currentPage=$nextPage'>next<
> > /a>";
> >             }
> > }
> >
> >
> >
> >
> >
> >
> > Anyone have any idea why only the same five names
> > might be being returned on
> > each of the pages?  I'm not getting something here.
> >
> > Thanks,
> > Ron
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi,

I'm having some troubles with sessions and PHP 4.1.2 in IIS 5 under 
WinNT. I'm using the standard session functions from php.

$cookie_params = session_get_cookie_params();
session_set_cookie_params($cookie_params["lifetime"],dirname($SCRIPT_NAME));
session_start();
session_register("g_sessionData");

The problem is that php sometimes doesn't find it's sessions anymore. I 
can see some file being created in de sessiondata dir, with the correct 
data in  them, but they are not loaded in the next page load. The 
problem might also have to do with cookies, because I see the sessionid 
being added to the link. I checked of course that cookies were enabled.

The strange thing this is that this problem only occurs in the document 
root of my site. The content management system, which runs in a subdir, 
works fine with sessions. When I placed my website in a subdir, it also 
worked fine.As you can see in the code, I set the path in the cookie. 
Might the paths of the main site and the site in the subdir interfear 
with each other (they both use the same code). This all works fine with 
Linux/Apache.

I've come acros a number of problem reports about PHP and IIS, stateing 
that session management doesn't work fine for certain PHP versions. Does 
anyone know what the status of these problems are and which PHP version 
has stable session management on a windows platform.

Greets,
Maurice

--- End Message ---
--- Begin Message ---
Sadly what Olivier suggests below doesn't work and generates the following
error message ......
Warning: Array to string conversion in d:\program files\apache
group\apache\htdocs\..........\products.php on line 10

It seems that rtrim is converting the array created by @file into a string.

What I had been trying to do was to set up some code along the following lines
..........
$var1 = @file("mytext_file.txt");
//reads file, creates array $var1
for ($counter=0; Scounter < count($var1); $counter++ {
$var2[$counter] = rtrim($var1[$counter], "\n");   }
//attempts to loop through each item in the array, trim off the \n
and assign to the same item in new array $var2

I'm pretty sure the above doesn't work, though I don't know why. Think I'll go
and try it again just in case though as I don't see any obvious errors. There
must be a way of running rtrim against every item in an array, trimming the \n
and writing each trimmed element to a new array.

Any ideas Olivier ..... anyone ?

Blu.

Olivier Hubert wrote:

> I don't know if you pasted the code directly from source, but your problem
> might come from the fact that you're using "/n" instead of "\n".
>
> What I recommend would be this:
> $myString = @file('text_file');
> $myArray = rtrim($myString, "\n");
>
> Note that for the second part, you might have to put \r and then \n (e.g.
> "\r\n") or simply no char specified. By default PHP will strip all
> whitespaces, tabs and end of line/NULL bytes when you use rtrim without a
> second parameter. You might want to give it a try.
>
> Hope this helps,
>
> Olivier Hubert
>
> At 13:23 2002-05-06 +0100, blulagoon wrote:
> >I don't know if this is the right way to go about what I'm trying to do.
> >
> >In a nutshell, I want to open a simple text file and load the file into
> >an array with each line represented by one element in the array.
> >Now $myArray = @file("my_text_file"); achieves 90% of what I want, but I
> >need to strip out the line feeds at the end of each line that are in the
> >original file.
> >
> >rtrim($myString, "/n") would seem to offer this functionality, but I
> >can't figure out the best way to use it with an array ?
> >
> >Anyone got this working, or is there another easier way to do it,
> >perhaps with a variant of file() which doesn't include the linefeeds
> >that I don't know about.
> >
> >Looking forwards to your input guys .....
> >
> >Blu.
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---

ok ... im lost ......

i've been working on my site .... i've xp & iis 5 &
php 4.1.2
now the server that im going to launch my site on is 
unix based ...... which i think works with 
apache alone ....... 

now i guess im stuck ..... what do i do now ......
convert all my hard work to unix and apache .... 
i believe i will have to change every single line of
code i've coded ... or what ????
& if i have to .... is there an easier way about it
... ????

guyz .... i'll appreciate any word on this .....

thnx a million ......

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
--- End Message ---

Reply via email to