GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Jun-2006, 20:34
Krazy_yA Krazy_yA is offline
New Member
 
Join Date: Apr 2006
Posts: 7
Krazy_yA is on a distinguished road

Find end of mysql file


Ok so I have a script set up that reads from a mysql database and for every record that it has it makes a page for each record. I have a navigation bar at the bottom of the page that allows the user to click ( Previous | Next ) to let the user navigate through the pages. I made it for when the first page is up "Previous" does not show. That was easy! Ok now when I get to the last page I need to check the database to see if there is a next record and if not to make "Next" dissapear. That is my problem, finding the end of the database file. I am using nested "if" statements to check. So what exactly am I looking for I do not know if it is

PHP Code:

if ($totalRows_checkcount == NULL) 


I know the == is not right or the NULL for that matter, so I dont know were im going from here. If anyone has any sujestions please help
Thanks
Last edited by LuciWiz : 06-Jun-2006 at 08:28. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 06-Jun-2006, 00:49
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: Find end of mysql file


Usually, you get the last page from the $totalpages count.

For example:

PHP Code:

function multi_page_navigation( $totalrows, $limit, $pageid )
{
    $totalpages = ceil( $totalrows / $limit );
    if( $totalpages <= 1 )
        return( null ); // do not show the multi-page links at all.
    // some flags...
    $first = $previous = $next = $last = false;
    $pages = null;
    $pagenumber = 0;

    for( $i=0; $i<$totalpages; $i++ )
    {
        ++$pagenumber;
        // FIRST / LAST
        if( !$first && !$last )
        {
            $first = ( $pageid==1 ? '&lt;&lt;' : '<a href="/example/" title="First Page">&lt;&lt;</a>' ) . ' ';
            $last = ( $totalpages==$pageid ? "&gt;&gt;" : "<a href=\"/example/?p=$totalpages\" title=\"Last Page\">&gt;&gt;</a>" ) . ' ';
        }
        // PREVIOUS / NEXT etc...
    }
    return( rtrim("$first$previous$pages$next$last") )
} 


 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB 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
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
How Do i get php to find out the file type of a file for me? viperman95833 MySQL / PHP Forum 2 08-Mar-2003 09:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:07.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.