php-windows Digest 7 Feb 2004 01:09:50 -0000 Issue 2110

Topics (messages 22742 through 22752):

Re: SQL to select a set of records
        22742 by: Nadim Attari
        22743 by: George Pitcher
        22744 by: David Felton
        22745 by: Stuart
        22747 by: Svensson, B.A.T. (HKG)
        22748 by: Herhuth, Ron
        22749 by: Frank M. Kromann
        22750 by: David Felton
        22751 by: Herhuth, Ron

Asyncron execution with "start"...
        22746 by: Svensson, B.A.T. (HKG)

Invalid referrer & URL sessions
        22752 by: Ethan Nelson

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 ---
> mysql> select * from table LIMIT 5,10;  # Retrieve rows 6-15

> If one argument is given, it indicates the maximum number of rows to
return:
> mysql> select * from table LIMIT 5;     # Retrieve first 5 rows

Dunno whether LIMIT works in Microsoft SQL Server ... someone may check it
plzzz

~nadim attari


--- End Message ---
--- Begin Message ---
I have both access and MySQL DBs and I have to change my method for Access
to 'select top 10 [fields] from table where x=x etc order by y'

MS SQLServer may need the same.

George in Oxford

> -----Original Message-----
> From: Nadim Attari [mailto:[EMAIL PROTECTED]
> Sent: 6 February 2004 11:33 am
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] SQL to select a set of records
>
>
> > mysql> select * from table LIMIT 5,10;  # Retrieve rows 6-15
>
> > If one argument is given, it indicates the maximum number of rows to
> return:
> > mysql> select * from table LIMIT 5;     # Retrieve first 5 rows
>
> Dunno whether LIMIT works in Microsoft SQL Server ... someone may check it
> plzzz
>
> ~nadim attari
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
No it doesn't. you'll need to do something like this in MS-SQL (using a
sub-select):

SELECT TOP 10 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files
WHERE     dbo.Table_MIS_Files.File_ID NOT IN 
(SELECT TOP 25 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files)

-----Original Message-----
From: Nadim Attari [mailto:[EMAIL PROTECTED]
Sent: 06 February 2004 11:33
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] SQL to select a set of records


> mysql> select * from table LIMIT 5,10;  # Retrieve rows 6-15

> If one argument is given, it indicates the maximum number of rows to
return:
> mysql> select * from table LIMIT 5;     # Retrieve first 5 rows

Dunno whether LIMIT works in Microsoft SQL Server ... someone may check it
plzzz

~nadim attari


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


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************

--- End Message ---
--- Begin Message --- David Felton wrote:
SELECT TOP 10 dbo.Table_MIS_Files.File_ID
FROM dbo.Table_MIS_Files
WHERE dbo.Table_MIS_Files.File_ID NOT IN (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
FROM dbo.Table_MIS_Files)

Shouldn't this be...


SELECT TOP 25 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files
WHERE     dbo.Table_MIS_Files.File_ID NOT IN
(SELECT TOP 10 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files)

That will get rows 11-25.
--
Stuart

--- End Message ---
--- Begin Message ---
set nocount on
create table test (a int , b char(1))
create table test_tmp (a int , b char(1))


insert into test values (1,  'a')
insert into test values (2,  'a')
insert into test values (3,  'b')
insert into test values (4,  'b')
insert into test values (5,  'c')
insert into test values (6,  'c')
insert into test values (7,  'd')
insert into test values (8,  'd')
insert into test values (9,  'e')
insert into test values (10, 'e')
insert into test values (11, 'e')
insert into test values (12, 'e')
insert into test values (13, 'e')
insert into test values (14, 'e')
insert into test values (15, 'e')
insert into test values (16, 'e')
insert into test values (17, 'e')
insert into test values (18, 'e')
insert into test values (19, 'e')
insert into test values (20, 'e')
insert into test values (21, 'e')
insert into test values (22, 'e')
insert into test values (23, 'e')
insert into test values (24, 'e')
insert into test values (25, 'e')
insert into test values (26, 'e')
insert into test values (27, 'e')
insert into test values (28, 'e')
insert into test values (29, 'e')
insert into test values (30, 'e')

insert into test_tmp
select top  25 *
from test
order by a asc

select * 
from test_tmp
where a in(
   select top 15 a
   from test_tmp
   order by a desc
)
order by a asc

drop table test_tmp
drop table test




-----Original Message-----
From: Stuart
To: David Felton
Cc: Nadim Attari; [EMAIL PROTECTED]; Herhuth, Ron
Sent: 2004-02-06 13:44
Subject: Re: [PHP-WIN] SQL to select a set of records

David Felton wrote:
> SELECT TOP 10 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files
> WHERE     dbo.Table_MIS_Files.File_ID NOT IN 
> (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files)

Shouldn't this be...

SELECT TOP 25 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files
WHERE     dbo.Table_MIS_Files.File_ID NOT IN
(SELECT TOP 10 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files)

That will get rows 11-25.
-- 
Stuart

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

--- End Message ---
--- Begin Message ---
Okay I tried this and while it doesn't error out I still only get the
first 10 records, if I change the first number I get the number of records
that I changed the number to.  If I change the second number nothing
happens.

SELECT TOP 10 dbo.individual.id, last_name, first_name
FROM  dbo.individual
WHERE     dbo.individual.id NOT IN
(SELECT TOP 30 individual.id
FROM  dbo.individual)


Thanks for the help,
Ron

>From: Svensson, B.A.T. (HKG)
>To: '[EMAIL PROTECTED]'
>Sent: 02/06/2004 8:42 AM
>set nocount on
>create table test (a int , b char(1))
>create table test_tmp (a int , b char(1))
>
>
>insert into test values (1,  'a')
>insert into test values (2,  'a')
>insert into test values (3,  'b')
>insert into test values (4,  'b')
>insert into test values (5,  'c')
>insert into test values (6,  'c')
>insert into test values (7,  'd')
>insert into test values (8,  'd')
>insert into test values (9,  'e')
>insert into test values (10, 'e')
>insert into test values (11, 'e')
>insert into test values (12, 'e')
>insert into test values (13, 'e')
>insert into test values (14, 'e')
>insert into test values (15, 'e')
>insert into test values (16, 'e')
>insert into test values (17, 'e')
>insert into test values (18, 'e')
>insert into test values (19, 'e')
>insert into test values (20, 'e')
>insert into test values (21, 'e')
>insert into test values (22, 'e')
>insert into test values (23, 'e')
>insert into test values (24, 'e')
>insert into test values (25, 'e')
>insert into test values (26, 'e')
>insert into test values (27, 'e')
>insert into test values (28, 'e')
>insert into test values (29, 'e')
>insert into test values (30, 'e')
>
>insert into test_tmp
>select top  25 *
>from test
>order by a asc
>
>select *
>from test_tmp
>where a in(
>   select top 15 a
>   from test_tmp
>   order by a desc
>)
>order by a asc
>
>drop table test_tmp
>drop table test
>
>
>
>
>-----Original Message-----
>From: Stuart
>To: David Felton
>Cc: Nadim Attari; [EMAIL PROTECTED]; Herhuth, Ron
>Sent: 2004-02-06 13:44
>Subject: Re: [PHP-WIN] SQL to select a set of records
>
>David Felton wrote:
>> SELECT TOP 10 dbo.Table_MIS_Files.File_ID
>> FROM         dbo.Table_MIS_Files
>> WHERE     dbo.Table_MIS_Files.File_ID NOT IN
>> (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
>> FROM         dbo.Table_MIS_Files)
>
>Shouldn't this be...
>
>SELECT TOP 25 dbo.Table_MIS_Files.File_ID
>FROM           dbo.Table_MIS_Files
>WHERE     dbo.Table_MIS_Files.File_ID NOT IN
>(SELECT TOP 10 dbo.Table_MIS_Files.File_ID
>FROM           dbo.Table_MIS_Files)
>
>That will get rows 11-25.
>--
>Stuart
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
create table #test (a int , b char(1))
create table #test_tmp (a int , b char(1))

Would make these tables real temp tables. These will be deleted wehn the
connection is closed.

- Frank

> set nocount on
> create table test (a int , b char(1))
> create table test_tmp (a int , b char(1))
> 
> 
> insert into test values (1,  'a')
> insert into test values (2,  'a')
> insert into test values (3,  'b')
> insert into test values (4,  'b')
> insert into test values (5,  'c')
> insert into test values (6,  'c')
> insert into test values (7,  'd')
> insert into test values (8,  'd')
> insert into test values (9,  'e')
> insert into test values (10, 'e')
> insert into test values (11, 'e')
> insert into test values (12, 'e')
> insert into test values (13, 'e')
> insert into test values (14, 'e')
> insert into test values (15, 'e')
> insert into test values (16, 'e')
> insert into test values (17, 'e')
> insert into test values (18, 'e')
> insert into test values (19, 'e')
> insert into test values (20, 'e')
> insert into test values (21, 'e')
> insert into test values (22, 'e')
> insert into test values (23, 'e')
> insert into test values (24, 'e')
> insert into test values (25, 'e')
> insert into test values (26, 'e')
> insert into test values (27, 'e')
> insert into test values (28, 'e')
> insert into test values (29, 'e')
> insert into test values (30, 'e')
> 
> insert into test_tmp
> select top  25 *
> from test
> order by a asc
> 
> select * 
> from test_tmp
> where a in(
>    select top 15 a
>    from test_tmp
>    order by a desc
> )
> order by a asc
> 
> drop table test_tmp
> drop table test
> 
> 
> 
> 
> -----Original Message-----
> From: Stuart
> To: David Felton
> Cc: Nadim Attari; [EMAIL PROTECTED]; Herhuth, Ron
> Sent: 2004-02-06 13:44
> Subject: Re: [PHP-WIN] SQL to select a set of records
> 
> David Felton wrote:
> > SELECT TOP 10 dbo.Table_MIS_Files.File_ID
> > FROM                dbo.Table_MIS_Files
> > WHERE     dbo.Table_MIS_Files.File_ID NOT IN 
> > (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
> > FROM                dbo.Table_MIS_Files)
> 
> Shouldn't this be...
> 
> SELECT TOP 25 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files
> WHERE     dbo.Table_MIS_Files.File_ID NOT IN
> (SELECT TOP 10 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files)
> 
> That will get rows 11-25.
> -- 
> Stuart
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
No. What I said was correct, as Ron wanted rows 25-35.

-----Original Message-----
From: Stuart [mailto:[EMAIL PROTECTED]
Sent: 06 February 2004 12:45
To: David Felton
Cc: Nadim Attari; [EMAIL PROTECTED]; Herhuth, Ron
Subject: Re: [PHP-WIN] SQL to select a set of records


David Felton wrote:
> SELECT TOP 10 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files
> WHERE     dbo.Table_MIS_Files.File_ID NOT IN 
> (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
> FROM          dbo.Table_MIS_Files)

Shouldn't this be...

SELECT TOP 25 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files
WHERE     dbo.Table_MIS_Files.File_ID NOT IN
(SELECT TOP 10 dbo.Table_MIS_Files.File_ID
FROM            dbo.Table_MIS_Files)

That will get rows 11-25.
-- 
Stuart


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************

--- End Message ---
--- Begin Message ---
It doesn't matter neither one works...they only bring back the first x
number of records.

Ron

>From: David Felton
>To: Stuart
>Sent: 02/06/2004 11:24 AM
>No. What I said was correct, as Ron wanted rows 25-35.
>
>-----Original Message-----
>From: Stuart [mailto:[EMAIL PROTECTED]
>Sent: 06 February 2004 12:45
>To: David Felton
>Cc: Nadim Attari; [EMAIL PROTECTED]; Herhuth, Ron
>Subject: Re: [PHP-WIN] SQL to select a set of records
>
>
>David Felton wrote:
>> SELECT TOP 10 dbo.Table_MIS_Files.File_ID
>> FROM         dbo.Table_MIS_Files
>> WHERE     dbo.Table_MIS_Files.File_ID NOT IN
>> (SELECT TOP 25 dbo.Table_MIS_Files.File_ID
>> FROM         dbo.Table_MIS_Files)
>
>Shouldn't this be...
>
>SELECT TOP 25 dbo.Table_MIS_Files.File_ID
>FROM           dbo.Table_MIS_Files
>WHERE     dbo.Table_MIS_Files.File_ID NOT IN
>(SELECT TOP 10 dbo.Table_MIS_Files.File_ID
>FROM           dbo.Table_MIS_Files)
>
>That will get rows 11-25.
>--
>Stuart
>
>
>**********************************************************************
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed. If you have received this email in error please notify
>the system manager.
>
>This footnote also confirms that this email message has been swept by
>MIMEsweeper for the presence of computer viruses.
>**********************************************************************
>
>
>

--- End Message ---
--- Begin Message ---
I tried to start an asyncroniously job on a win2003 server with php 4.3.4
(november build) with system("start ...") and passthru("start ...") however
it turns out that the php call is waiting until completion of the command
that starts invoke..

Thinking about it, it seams like start does fork a bit different then when
invoked from a command shell, i.e, start connects php with whatever it
starts up, but should it actually behave like this?

Nota bene: I've manage to start up async jobs with php, by other means.

Any comments?

--- End Message ---
--- Begin Message ---
I have a problem with starting sessions on my site.  Lets say someone comes
from site random.com but the link they click on to get to my site has a
?sessid=gobildygook in its href.  The way things are now, the session starts
right up using the sessid saved in their href.  I suppose this could also
happen with bookmarks.

This means that, assuming garbage collection has not run on the server, any
user can come to my site using that link and the server won't be able to
tell them apart.

In trying to fix this problem, here's my logic so far.  If the user hits my
site and their referer doesn't match the host AND there is a sessidset in
the GET vars, then forward them around with header commands to strip out the
sessionid.  Then start a new unique session, then go back to my page.
However, the referer doesn't change when you use header commands.  Now, I'm
back in the same situation... i.e. the referer doesn't match the host and
there is a sessid.  Its a good one, but the application doesn't know that?

Is there an elegant, simple way to validate sessid's as being unique in the
GET vars when a user hits a site?

Of course, assume we can't rely on cookies to be enabled for any reason.  I
really appreciate any light you guys/gals can shed on this thing... driving
me crazy.  I've thought of validating against the files in the temp
directory... but that won't always work cause of garbage collection
delays... I've thought about reading the RFC's for headers and changing the
referer after assigning a new sessid, but that doesn't mean someone else out
there couldn't write a script to fool my app anyway?

-Ethan Nelson,
Modulus, LLC

--- End Message ---

Reply via email to