RE: Page Numbering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What do I have to do to get off this list. Murder someone?
Please take me off the list as I have already tried to unsubscribe several
times.

The email is registered under will@xxxxxxxxxxxxxxxxxxxxx  

-----Original Message-----
From: Jim Lucas [mailto:lists@xxxxxxxxx] 
Sent: Thursday, September 20, 2007 4:03 AM
To: Dan Shirah
Cc: php-general
Subject: Re:  Page Numbering

Dan Shirah wrote:
> Whenever the query has the NOT IN included in it, I get the following
error:
> 
> Warning: mssql_query()
>
[function.mssql-query<http://develop1/credit%20card%20processing/Process/fun
ction.mssql-query>]:
> message: Incorrect syntax near the keyword 'as'. (severity 15)
> 
>>
>> <?php
>>
>> # Get page number if passed to script $page = intval( 
>> empty($_GET['page']) ? 1 : $_GET['page'] );
>>
>> # Set number of rows to display from result set $max_results = 10;
>>
>> # Calculate the number of results that we have already looked at 
>> $page_results = intval(($page*$max_results)-$max_results);
>>
>> # Set your ORDER BY criteria.  This needs to be the same for each SQL 
>> statement # This is why I have setup a variable, so no mistakes will 
>> be made $order_by_criteria = 'credit_card_id';
>>
>> # Figure out which SQL statement we need to use if ( $page === 1 ) {
>>
>>        # Query for page 1
>> $SQL = "SELECT  TOP {$max_results}
>>                Value1, Value2
>>        FROM    my_table
>>        ORDER BY {$order_by_criteria}";
>>
>> } else {
>>
>>        # Query for page 2 and greater $SQL = "SELECT  TOP 
>> {$max_results}
>>                Value1, Value2
>>        FROM    my_table
>>        WHERE   credit_card_id NOT IN (
>>                        SELECT  TOP {$page_results}
>>                                credit_card_id
>>                        FROM    my_table
>>                        WHERE   my_table.column = 'P'
>>                        ORDER BY {$order_by_criteria}
>>                ) AS newtbl

yup, sorry, missed that in the copy/paste  remove the 'AS newtbl' part

>>        ORDER BY {$order_by_criteria}";
>>
>> }
>>
>> ... run your $SQL statement here and work with the results ?>


--
Jim Lucas

    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
     by William Shakespeare

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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux