Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-14-2006, 12:20 PM   #1
Kenzo
Senior Member
 
Kenzo's Avatar
 
Join Date: Aug 2004
Posts: 128
Default having numbered pages

im trying to have numbered pages in my results page, but for some reason i keep getting the mysql_fetch_array(): error message, i dont know what im doing wrong, any ideas, the code is below.....


PHP Code:

    <? 
            
                
// mumber of pages to be displayed....
                
                
$display 10;
                
                
//how many Pages Kenzo?
                
                
if (isset($_GET['np']))
                {
                
                
$num_pages $_GET['np'];
                }
            
                else
                
                {
                    
// count this s.....
                
                    
$query " SELECT COUNT (*) FROM tablex ORDER BY id ASC";
                    
$result mysql_query ($query);
                    
$row mysql_fetch_array ($resultMYSQL_NUM);
                    
$num_records $row[0];
                    
                    
                    }
                
                
                    
// how many pages?
                
                    
if ($num $display)
                    {
                    
$num_pages ceil ($num_records/$display);
                    }
                    else
                    {
                    
$num_pages 1;
                    }
                
                
                
            
            
                
// check 
                
                
if (isset($_GET['s']))
                {
                
$start $_GET['s'];
                }
                else
                {
                
$start 0;
                }
            
            
            
                
// catch location
                
$location =  $_POST['cmp'] ;
                
$category =  $_POST['cat'] ;
            
            
            
                  
$query mysql_query("
                    SELECT *
                 FROM
                 tablex
                 WHERE
                 location = '
$location' AND 
                 category = '
$category'
                 ORDER BY
                 id
                ASC
                LIMIT 
$start$display
                 "
,$db);
                 }
        
                
                
$num mysql_num_rows($query);
                
                
                
                
// number of comapnies check.......
                
if ($num 0) {
                echo 
"<span class='redno'> $num $category</span> in <span class='redno'> $location </span> displayed........<br><br>";
                }
                else
                {
                echo 
"Search returned no companies....Sorry.";
                }
                  
?>
                


  <br><br>            




        
        <?
        
        

        
// print companies and duplicate rows......
        
while ($row mysql_fetch_array($query)) {
        
        
        echo 
"<div class='rsbar'></div><br><table class='phptable'><tr><td><span class='mheader'>COMPANY NAME :</span></td><td>" $row['companyname'] . " </td></tr><tr><td><span class='mheader'>LOCATION :</span></td><td>" $row['location'] . "</td></tr><tr><td><span class='mheader'>NATURE OF BUSINESS :</span></td><td>" $row['category'] . "</td></tr><tr><td><span class='mheader'></span></td><td> <a href='../login_pass.php'>Contact Details</a></td></tr></table><br>";
        

        
        }
        
        
mysql_close();
        
        
        
        
        
// Make Links........
        
        
if ($num_pages 1)
        {
        echo 
"<br>";
        
        
$current_page = ($start/$display) + 1;
        
        
                    
// make previous button
                    
                    
if ($current_page != 1
                    {
                    echo 
"<a href='catcmpresults.php?s=" . ($start $display) . "&np=" $num_pages "'> Previous </a>";
                    
                    }
        
        
        
        
        
        
// make numbered pages
        
        
for ($i 1$i <= $num_pages$i++)
                {
                if (
$i != $current_page)
                            {
                            echo 
"<a href='catcmpresults.php?s=" . (($display * ($i 1))) . "&np=" $num_pages "'>" $i "</a>";
                            
                            }
                            else
                            {
                            echo 
$i " ";
                            }
                
                }
        
                    
                    
// make next button
                    
                    
if ($current_page != $num_pages
                    {
                    echo 
"<a href='catcmpresults.php?s=" . ($start $display) . "&np=" $num_pages "'> Previous </a>";
                    
                    }
        
        echo 
"<br>";
        
        }
        
        
?>
Kenzo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How? Flash MX Library Pages Adding to Scene BryanP Other Flash General Questions 1 09-17-2006 12:06 PM
Adding pages to Flipbook dahl ActionScript 1.0 (and below) 10 07-20-2005 10:01 PM
Getting Flash to load HTML pages into iframes in a seperate HTML page Deadhands ActionScript 1.0 (and below) 2 05-11-2004 09:18 AM
Best navigation method for site pages danny Simple Stuff (Newbies) 1 12-17-2003 12:00 PM


All times are GMT. The time now is 09:26 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.