To alter the error reporting at runtime, instead of using the ISP's php.ini... look at

(...The manual....)

Which lets you alter how the reporting is handled.

    Originally posted by jassh
    dude..

    anyway, try this:
    try to change your ['PHP_SELF'] to
    $_SERVER['SCRIPT_NAME']

    that works for me...
    how about giving it a go and tell us about it..

    :p

    Tnx...tried this on the Line 161 problem:

    $_SERVER['tryagain2.php']

    ...and now get this:

    Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in <filename> on line 161

    ARRRGGGHHH!!!!

    Tnx also to phpmike & The Chancer, but it would seem to me that wisdom would be to eliminate whatever the source of errors are in a script in the first place???

      err.. phplearner dude..

      i think you get me wrong...

      when i meant use $_SERVER['SCRIPT_NAME'] instead of $PHP_SELF..

      i didnt mean for you to change
      the 'SCRIPT_NAME' to your file name,
      just write i as

      $_SERVER['SCRIPT_NAME']
      

      without changing it to something else..

      hope that clears things out

      have a nice day dude.. 🙂
      rawk onn...

      -jassh

        jassh:

        I sincerely appreciate your efforts here, and thanks for clarifying.

        So...I did as you suggested but still get an error on Line 161 (which now reads):

        echo "<TR bgcolor=\"#4f5c38\">
                <TD><font color=\"white\"><a href=\"$_SERVER['SCRIPT_NAME']?query=$query&limit=$limit&order=domains\">Domain Name</a></font></TD>
                <TD><font color=\"white\">Date Submitted</font></TD>
                <TD><font color=\"white\"><a href=\"$PHP_SELF?query=$query&limit=$limit&order=price\">Asking Price</a></font></TD></TR>\n";
        //defines the clickable sort ordering by header title while maintaining $limit (listing offset)
        

        Unfortunately, that did not solve the problem
        :mad:

        ARRRGGGGGHHHHHHH...

          PHPLEARNER mate - you got me wrong...

          There is no error when it gives you a notice... it is just letting you know something..

          Say for example, you wanted some code to run when the form is submitted, but the variable you use for this won't be set until you submit the form. The NOTICE is just letting you know that this is not set yet, but when you send the form - HEY PRESTO, the notice goes away..

          It is there so that you can develop your code and see things, but it also gives you the option of supressing this so that your code runs without any nasty "error like" messages popping up.

          As for your code probs... try this:

          echo "<TR bgcolor=\"#4f5c38\">
                 <TD><font color=\"white\"><a href=\"".
                 $_SERVER['SCRIPT_NAME'].
                 "?query=$query&limit=$limit&order=domains\">Domain Name</a></font></TD>
                 <TD><font color=\"white\">Date Submitted</font></TD><TD><font color=\"white\"><a href=\"".
                 $_SERVER['SCRIPT_NAME'].
                 "?query=$query&limit=$limit&order=price\">Asking Price</a></font></TD>
               </TR>\n";
          //defines the clickable sort ordering by header title while maintaining $limit (listing offset)
          

          Note the use of ". ." around the $_SERVER['SCRIPT_NAME']

            hi there all...

            well, just wanna share something here..
            if you guys dont mind..

            i know that everyone has their own method in coding..
            and often we do have to echo HTML code in PHP..

            i would normally use single quote '
            to replace the double quotes "
            in a HTML code when echoing em
            (which normally generated by Web Authoring Tool like dreamweaver and stuff..)

            and i use double quotes only to start and also to end an echo statement

            so if i were to rewrite the code given,
            i'd do it like this

            
            echo "<TR bgcolor='#4f5c38'>
                    <TD><font color='white'><a href='$_SERVER['SCRIPT_NAME']?query=$query&limit=$limit&order=domains'>Domain Name</a></font></TD>
                    <TD><font color='white'>Date Submitted</font></TD>
                    <TD><font color='white'><a href='$_SERVER['SCRIPT_NAME']?query=$query&limit=$limit&order=price'>Asking Price</a></font></TD>
                  </TR><BR>";
            //defines the clickable sort ordering by header title while maintaining $limit (listing offset)
            
            

            and owh.. i also normally 'declare' a variable to the $_SERVER['SCRIPT_NAME']

            like this..

            
            $this_document = $_SERVER['SCRIPT_NAME']; // for those who like java style coding
            
            //then you can echo it like this..
            
            echo "<TR bgcolor='#4f5c38'>
                    <TD><font color='white'><a href='$this_document?query=$query&limit=$limit&order=domains'>Domain Name</a></font></TD>";
            
            
            

            i know it seems like a lot of work..
            but it's kind of fun... somehow..

            anyway, if you think your php gives way too much errors..
            i suggest try look into the 'php.ini'

            check out where they have this error handling settings..
            i think its 'show_all_error' or sumthin like that
            you might wanna turn it off..
            although it is OFF by default...
            setting this ON can generate error message even by say,
            not declaring a variable.. and some other small scale stuff
            that would normally wont matter..

            i only set this ON temporarily so that i can check
            some really fatal error, like header already sent..
            which until today i dont quite get it on header handling..

            just sharing though..
            hope that helps...

            cheers;

            -jassh

              jassh & The Chancer:

              Once again, I appreciate your assistance guys.

              I tried both suggestions but still get have the Line 161 error.

              This is blowing me away...makes no sense.

              Again, I will NOT have control over any changes to php.ini settings.

              ARRRRGGGGGHHHHH (to the power of 10!!!)

              BTW, for some reason, this thread is SOOOOOOOOOOOoooooo wide on my 1280 x 1024 display (all other threads do NOT require me to use the horizontal scroll bar at the bottom). I find this most odd.😕

                yeahhh.. i also wonder why this thread is sooo looongg horizontally..

                anyway, phplearner.. try this...

                
                <?PHP
                
                echo $_SERVER['SCRIPT_NAME'];
                
                ?>
                
                

                tell what came out...

                • jassh

                  jassh:

                  I named the test file (only the 3 lines of code):

                  zjasshtest.php

                  1. On my WIN2K machine I got:

                  /php/php.exe

                  1. On my ISP's AIX Unix machine I got:

                  /zjasshtest.php

                  I find this quite interesting. All scripts must be thoroughly tested
                  on my Apache/PHP/MySQL WIN2K Desktop before uploading to the Unix. If I can't develop on my WIN2K system I'm screwed, so everything must be compatible.

                    hmm.. strange indeed...
                    and of course.. interesting..

                    well, like you..
                    i too.. develop my stuff on win2k..
                    and upload it on my linux webhosting..

                    and normally, if i run both the script i gave ya..
                    they both return the same value..
                    supposedy '/zjasshtest.php'

                    i guess...
                    you should try and check back your installation...
                    maybe the configuration for apache under the .conf
                    on your win2k???

                    how do you install them??
                    manually (one by one) ??
                    or thru some automated style like..
                    err.. some compiled combo setup (php+mysql+apache)?
                    available on the net somewhere..
                    (i read about them once)

                    other than that..
                    i guess it's not your coding...
                    but merely your webserver system on your desktop..

                    best of luck in resolving the problem..
                    take care..

                    cheers;
                    - jassh

                      jassh-

                      Nope...all separate installs.

                      I am running PHP4.2.2 WIN32 here.

                      Forgot to tell The Chancer that unfortunately, the error(s) that show do NOT allow me to actually get to the "Form" which is
                      part of the problem.

                        17 days later

                        Hey all, ok I finally upgraded my php to version 4.2.3 and went through the Global variable hell you are all talking about. My ISP has their globals turned ON by default BUT I did my testing on my own rig (PHP 4.2.3 /APACHE 1.3.27/MySQL 4)with GLOBALS=OFF

                        Anywhoo-to make a long story short, I got this beeotch to work using the following code:

                        <?
                        $this_document = $_SERVER['SCRIPT_NAME']; 
                        $db_addr = 'localhost';		// address of MySQL server.
                        $db_user = '';		// Username to access server.
                        $db_pass = '';		// Password access server.
                        $db_name = 'domaintrader';	// Name of database to connect to.
                        $connect = @mysql_connect("$db_addr", "$db_user", "$db_pass");
                        
                        $page = $_GET['page'];
                        $limit = $_GET['limit'];
                        
                        if (!($connect)) // If no connect, error and exit().
                        {
                         echo("<p>Unable to connect to the database server.</p>");
                         exit();
                        }
                        
                        if (!(@mysql_select_db($db_name))) // If can't connect to database, error and exit().
                        {
                         echo("<p>Unable to locate the $db_name database.</p>");
                         exit();
                        }
                        
                        
                        
                        
                        if (!($limit)){
                         $limit = 10; // Default results per-page.
                        }
                        
                        if ( !$page or $page < 0 ) {
                         $page = 0; // Default page value.
                        }
                        
                        $numresults = mysql_query("SELECT * FROM domains"); // the query.
                        
                        $numrows = mysql_num_rows($numresults); // Number of rows returned from above query.
                        
                        if ($numrows == 0){
                         echo("No results found matching your query"); // modify the "Not Found" error for your needs.
                         exit();
                        }
                        
                        
                        
                        $pages = intval($numrows/$limit); // Number of results pages.
                        // $pages now contains int of pages, unless there is a remainder from division.
                        
                        if ($numrows % $limit) {
                         $pages++; // has remainder so add one page
                        }
                        
                        $current = intval($page/$limit) + 1; // Current page number.
                        
                        if (($pages < 1)) {
                         $total = 1; // If $pages is less than one, total pages is 1.
                        } else {
                         $total = $pages; // Else total pages is $pages value.
                        }
                        
                        $first = $page + 1; // The first result.
                        
                        if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
                         $last = $page + $limit; //If not last results page, last result equals $page plus $limit.
                        } else {
                         $last = $numrows; // If last results page, last result equals total number of results.
                        }
                        //escape from PHP mode.
                        ?>
                        
                        <html>
                        <head>
                        <title>Untitled Document</title>
                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        </head>
                        
                        <body>
                        <table width="100%" border="0" cellpadding="2">
                          <!--DWLayoutTable-->
                          <tr> 
                            <td width="323" align="left"><font
                               face="Arial, Helvetica, sans-serif"><font size="1">Results 
                              per-page: <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=5">5</a> 
                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=10">10</a> 
                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=20">20</a> 
                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=50">50</a></font>&nbsp; 
                              </font></td>
                            <td colspan="2" align="left"><font
                             size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
                          </tr>
                          <tr> 
                            <td align="left"><font size="2" face="Arial, Helvetica, sans-serif">Showing 
                              Results <b> 
                              <?=$first?>
                              </b> - <b> 
                              <?=$last?>
                              </b> of <b> 
                              <?=$numrows?>
                              </b></font></td>
                            <td width="324" align="left"><font size="2" face="Arial, Helvetica, sans-serif">Page 
                              <b> 
                              <?=$current?>
                              </b> of <b> 
                              <?=$total?>
                              </b></font></td>
                            <td width="324" align="left"><font
                             size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
                          </tr>
                          <tr> 
                            <td colspan="3" align="left" valign="top"><font
                               size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font>
                              <div align="left"><font size="2" face="Arial, Helvetica, sans-serif"></font></div>
                              <font size="2" face="Arial, Helvetica, sans-serif">&nbsp; 
                              <? 
                        //$limitnum = 15;
                        if ($page != 0) { // Don't show back link if current page is first page.
                         $back_page = $page - $limit;
                         echo("<a href=\"$this_document?query=$query&page=$back_page&limit=$limit\">back</a>\n");
                        }
                        
                        for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it.
                        {
                         $ppage = $limit*($i - 1);
                         if ($ppage == $page) {
                          echo("<b>$i</b>\n");
                         } // If current page don't give link, just text.
                        //elseif ($ppage < $page - $limitnum || $ppage > $page + $limitnum){} 
                         else {
                          echo("<a href=\"$this_document?query=$query&page=$ppage&limit=$limit\">$i</a>\n");
                         }
                        }
                        
                        if (!((($page+$limit) / $limit) >= $pages) &&
                            $pages != 1) { // If last page don't give next link.
                         $next_page = $page + $limit;
                         echo("    <a href=\"$this_document?query=$query&page=$next_page&limit=$limit\">next</a>");
                        }
                        ?>
                            </font></td>
                          </tr>
                          <tr> 
                            <td colspan="3" align="left"><!--DWLayoutEmptyCell-->&nbsp;</td>
                          </tr>
                          <tr> 
                            <td colspan="3" align="left"> 
                              <?
                        //Go back into PHP mode.
                        // Now we can display results
                        
                        $results = mysql_query("SELECT *
                                                FROM domains
                                                ORDER BY domains ASC
                                                LIMIT $page, $limit");
                        echo "<TR bgcolor=\"#4f5c38\">
                                <TD align=\"center\"><font color=\"#CCCC66\"><strong>Domain Name</strong></font></TD>
                                <TD align=\"center\"><font color=\"#CCCC66\"><strong>Date Submitted</strong></font></TD>
                                <TD align=\"center\"><font color=\"#CCCC66\"><strong>Asking Price</strong></font></TD></TR>\n";
                        
                        for($i = 0; $i < $limit; $i++){
                         for ($count = 1; $row = mysql_fetch_assoc ($results);++$count) {
                          if ($count & 1) {
                           $color = "#9aa486";
                           $font = "white";
                          } else {
                           $color = "#c8cfc6";
                           $font = "black";
                          }
                          $printthis = "<tr>
                           <td bgcolor=\"$color\"><font color=\"$font\">$row[domains]</font></td>
                           <td bgcolor=\"$color\"><font color=\"$font\">$row[domainDate]</font></td>
                           <td bgcolor=\"$color\"><font color=\"$font\">$row[price]</font></td>
                        </tr>";
                        print $printthis;
                         }
                        }
                        ?>
                            </td>
                          </tr>
                        </table>
                        </body>
                        </html>
                        
                        

                        I hope it works for all of you, it does me on both my own server and on my ISP's server...yee ha!

                        Here is the example URL again to view it working:

                        EXAMPLE

                          Hey Drew:

                          Thanks for your efforts. YOUR example page works fine.

                          However, I loaded it up here and immediately get the following:

                          Notice: Undefined index: page in c:\www\test\domaintrader\dt.php on line 9

                          Notice: Undefined index: limit in c:\www\test\domaintrader\dt.php on line 10

                          FYI, Lines 9 & 10 are:

                          $page = $GET['page'];
                          $limit = $
                          GET['limit'];

                          Then, if I click on one of the Results per-page number options, I get this:

                          Security Alert! The PHP CGI cannot be accessed directly.
                          This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

                          For more information as to why this behaviour exists, see the manual page for CGI security.

                          For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

                          Umh, but it will do me no good to look at a manual, because whatever I use MUST work with the settings already in place.

                          I just don't understand, but sure appreciate your sharing and all your hard work there.

                            Hey there PHPLearner...sorry to see that there are still probs with the code...I think its definitely your setup however now. I am most willing to help you uninstall, and re install php 4.3.1, apache 1.3.27 and MySQL 4.0.12 on your Windows box. I am running XP by the way...

                            If you want my assistance then go to my website and fill in a message on my contact me page.

                            That way I will send you the instructions for installation again and/or you can add me to MSN Messenger and I will help you with its setup in real time. I will give you my MSN addy in my reply email...

                            I have never seen those kind of errors before and I have installed these 3 proggies over 30 times on various O/S systems since getting into this stuff.

                            I am making an assumption that its the config of one or more of the programs that are causing you grief.

                            I think its the PHP.ini myself but hey I could be wrong.
                            Thing is, the code works with both globals on and off with appropriate tweaks, so that should tell us its something else and troubleshooting the setup will either fix the problem or point us to something else...

                            What are your thoughts?

                            I want to see you get this working man!

                              Hi chaosdivine:

                              I really appreciate your kind offer for assistance. However, if something works on my machine then it works on my ISP's AIX Unix configuration (which I have no control over to change).

                              I just checked and the config is:

                              PHP 4.3.1
                              Apache 1.3.27
                              MySQL 3.23.51

                              It is my understanding they run with standard defaults as shipped, but the Tech Guru owner said a real "bear" compiling
                              MySQL for AIX flavor Unix & they are not too keen on making
                              any more changes at this point (plus he is now on vacation).

                              All 'config' settings for the above are CAST-IN-STONE there.

                              So, my 'benchmark' here is if stuff works on my PC under the
                              current configuration, it ALWAYS works up on the Unix!!!

                              Regards...

                              P.S. BTW, there is something VERY BIZARRE about this thread...it is SOOOOOOOOooooo W-I-D-E ;-(

                                I would agree with you that it is bizzare that this thread is so wide...I dunno why that is. It is even more strange that you are the only one getting these errors with the script and no one else is.

                                I can only say that we have tried. I sincerely wish you well in trying to track down the cause.

                                Hope to see you around PHPBuilder in the future,

                                Drew

                                  22 days later

                                  Good code. Here's how I chose to do the ascending/descending:

                                  <?
                                  $cnt=$_GET["idct"];
                                  if($cnt==0) { echo ("<a href=\"$PHP_SELF?order=id&sort=asc&idct=1\">ID</a>"); 
                                  }
                                  elseif($cnt==1) { echo ("<a href=\"$PHP_SELF?order=id&sort=desc&idct=0\">ID</a>");
                                  }
                                  ?>
                                  

                                  And going off what you already have,

                                  <? 
                                  $default_sort = 'id';
                                  $allowed_order = array ('id', 'word', 'type'); 
                                  if (!isset ($_GET['order']) || 
                                      !in_array ($_GET['order'], $allowed_order)) {
                                      $order = $default_sort;
                                  	$sort = asc;
                                  } else {
                                      $order = $_GET['order'];
                                  	$sort = $_GET['sort'];
                                  }
                                  
                                  ?>
                                  

                                    I have the code that chaosdivine post a few posts back working great...except....
                                    When I click on either 1,2,3, etc. or next

                                    I get the following error:

                                    No results found matching your query

                                    Did anyone run into this?

                                      I look at this piece of code

                                      <td width="323" align="left"><font size="1" face="Arial, Helvetica, sans-serif">Results
                                      per-page: <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=5">5</a>
                                      | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=10">10</a>
                                      | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=20">20</a>
                                      | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=50">50</a><

                                      and am a little puzzled as I do not see where $query is specified. Could this be my issue...

                                        Hmmm, I still am unable to figure out why I cant get the pagination to work correctly. Whenever I click on next....it says no results found. This make me think it is loosing the query??? I am still learning all this. Can someone take a peek at my code and help me solve my problem? Thanks so much...

                                        
                                        <?
                                        $this_document = $_SERVER['newcode.php']; 
                                        $db_addr = 'localhost';        // address of MySQL server.
                                        $db_user = 'xxx';        // Username to access server.
                                        $db_pass = 'xxx';        // Password access server.
                                        $db_name = 'xxx';    // Name of database to connect to.
                                        $connect = @mysql_connect("$db_addr", "$db_user", "$db_pass");
                                        
                                        $page = $_GET['page'];
                                        $limit = $_GET['limit'];
                                        
                                        if (!($connect)) // If no connect, error and exit().
                                        {
                                             echo("<p>Unable to connect to the database server.</p>");
                                             exit();
                                        }
                                        
                                        if (!(@mysql_select_db($db_name))) // If can't connect to database, error and exit().
                                        {
                                             echo("<p>Unable to locate the $db_name database.</p>");
                                             exit();
                                        }
                                        
                                        
                                        
                                        
                                        if (!($limit)){
                                             $limit = 10;} // Default results per-page.
                                        
                                        if ( !$page or $page < 0 ) { $page = 0; } // Default page value.
                                        
                                        $numresults = mysql_query("SELECT town, list_price, bedrooms, baths, rooms, Id ,
                                                                     IF (lister_office_name like 'Century 21 Highview Realty', 1, 0)
                                                                       AS featured
                                                                   FROM residential
                                                                   WHERE town = '$selecttown'
                                                                     AND list_price BETWEEN '$lowprice' AND '$highprice'
                                                                     AND bedrooms like '%$bedroomsel'
                                                                     AND baths like '%$bathselect'
                                                                   ORDER BY featured DESC,
                                                                     list_price DESC"); // the query.
                                        
                                        $numrows = mysql_num_rows($numresults); // Number of rows returned from above query.
                                        
                                        if ($numrows == 0){
                                         echo("No results found matching your query"); // modify the "Not Found" error for your needs.
                                         exit();
                                        }
                                        
                                        $pages = intval($numrows/$limit); // Number of results pages.
                                        // $pages now contains int of pages, unless there is a remainder from division.
                                        
                                        if ($numrows % $limit) {
                                         $pages++; // has remainder so add one page
                                        }
                                        
                                        $current = intval($page/$limit) + 1; // Current page number.
                                        
                                        if (($pages < 1)) {
                                         $total = 1; // If $pages is less than one, total pages is 1.
                                        } else {
                                         $total = $pages; // Else total pages is $pages value.
                                        }
                                        
                                        $first = $page + 1; // The first result.
                                        
                                        if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
                                         $last = $page + $limit; //If not last results page, last result equals $page plus $limit.
                                        } else {
                                         $last = $numrows; // If last results page, last result equals total number of results.
                                        }
                                        //escape from PHP mode.
                                        ?>
                                        <html>
                                        <head>
                                        <title>Untitled Document</title>
                                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                                        </head>
                                        
                                        <body>
                                        <table width="100%" border="0" cellpadding="2">
                                          <!--DWLayoutTable-->
                                          <tr> 
                                            <td width="323" align="left"><font face="Arial, Helvetica, sans-serif"><font size="1">Results 
                                              per-page: <a href="http://www.century21highview.com/newcode.php?query=<?=$query?>&page=<?=$page?>&limit=5">5</a> 
                                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=10">10</a> 
                                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=20">20</a> 
                                              | <a href="<?=$this_document?>?query=<?=$query?>&page=<?=$page?>&limit=50">50</a></font>&nbsp; 
                                              </font></td>
                                            <td colspan="2" align="left"><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
                                          </tr>
                                          <tr> 
                                            <td align="left"><font size="2" face="Arial, Helvetica, sans-serif">Showing 
                                              Results <b> 
                                              <?=$first?>
                                              </b> - <b> 
                                              <?=$last?>
                                              </b> of <b> 
                                              <?=$numrows?>
                                              </b></font></td>
                                            <td width="324" align="left"><font size="2" face="Arial, Helvetica, sans-serif">Page 
                                              <b> 
                                              <?=$current?>
                                              </b> of <b> 
                                              <?=$total?>
                                              </b></font></td>
                                            <td width="324" align="left"><font
                                             size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
                                          </tr>
                                          <tr> 
                                            <td colspan="3" align="left" valign="top"><font
                                               size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font> 
                                              <div align="left"><font size="2" face="Arial, Helvetica, sans-serif"></font></div>
                                              <font size="2" face="Arial, Helvetica, sans-serif">&nbsp; 
                                              <? 
                                        //$limitnum = 15;
                                        if ($page != 0) { // Don't show back link if current page is first page.
                                         $back_page = $page - $limit;
                                         echo("<a href=\"$this_document?query=$query&page=$back_page&limit=$limit\">back</a>\n");
                                        }
                                        
                                        for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it.
                                        {
                                         $ppage = $limit*($i - 1);
                                         if ($ppage == $page){
                                          echo("<b>$i</b>\n"); // If current page don't give link, just text.
                                         }
                                         //elseif ($ppage < $page - $limitnum || $ppage > $page + $limitnum){} 
                                         else {
                                          echo("<a href=\"$this_document?query=$query&page=$ppage&limit=$limit\">$i</a>\n");
                                         }
                                        }
                                        
                                        if (!((($page+$limit) / $limit) >= $pages) &&
                                            $pages != 1) { // If last page don't give next link.
                                         $next_page = $page + $limit;
                                         echo("    <a href=\"$this_document?query=$query&page=$next_page&limit=$limit\">next</a>");
                                        }
                                        ?>
                                              </font></td>
                                          </tr>
                                          <tr> 
                                            <td colspan="3" align="left"><!--DWLayoutEmptyCell-->&nbsp; </td>
                                          </tr>
                                          <tr> 
                                            <td colspan="3" align="left"> 
                                              <?
                                        //Go back into PHP mode.
                                        // Now we can display results
                                        
                                        $results = mysql_query("SELECT town, list_price, bedrooms, baths, rooms, Id ,
                                                                  IF (lister_office_name like 'Century 21Highview Realty', 1, 0)
                                                                    AS featured
                                                                FROM residential
                                                                WHERE town = '$selecttown'
                                                                  AND list_price BETWEEN '$lowprice' AND '$highprice'
                                                                  AND bedrooms like '%$bedroomsel'
                                                                  AND baths like '%$bathselect'
                                                                ORDER BY featured DESC,
                                                                  list_price DESC
                                                                LIMIT $page, $limit");
                                        echo "<TR bgcolor=\"#4f5c38\">
                                          <TD align=\"center\"><font color=\"#CCCC66\"><strong>ID</strong></font></TD>
                                          <TD align=\"center\"><font color=\"#CCCC66\"><strong>blah</strong></font></TD>
                                          <TD align=\"center\"><font color=\"#CCCC66\"><strong>Price</strong></font></TD>
                                        </TR>\n";
                                        
                                        for($i = 0; $i < $limit; $i++) {
                                         for ($count = 1; $row = mysql_fetch_assoc ($results);++$count) {
                                          if ($count & 1) {
                                           $color = "#9aa486";
                                           $font = "white";
                                          } else {
                                           $color = "#c8cfc6";
                                           $font = "black";
                                          }
                                          $printthis = "
                                        <tr>
                                        <td bgcolor=\"$color\">
                                        <font color=\"$font\">$row[Id]</font>
                                        </td>
                                        <td bgcolor=\"$color\">
                                        <font color=\"$font\">$row[name]</font>
                                        </td>
                                        <td bgcolor=\"$color\">
                                        <font color=\"$font\">$row[list_price]</font>
                                        </td></tr>";
                                        print $printthis;
                                        }
                                        
                                        }
                                        ?>
                                            </td>
                                          </tr>
                                        </table>
                                        </body>
                                        </html>
                                        

                                        When I click on next the url looks like this....

                                        http://www.myurl.com/newcode.php?query=&page=10&limit=10

                                        Also, I am passing variables through a form to this script.