SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Wibblesticks Gryff's Avatar
    Join Date
    Oct 2001
    Location
    Asgard
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with a tiny script

    $posvar = 1;
    while($row = mysql_fetch_array($query))
    {
    echo("$posvar");
    $posvar = ( $posvar + 1 );
    }

    basically i want to know how to only echo the last result as that will give me the total number of rows in my db
    thanks for any help as per usual

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use mysql_num_rows()

    PHP Code:
    $sql mysql_query("SELECT what FROM table");
    $rows mysql_num_rows($sql);

    echo 
    $rows
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    Wibblesticks Gryff's Avatar
    Join Date
    Oct 2001
    Location
    Asgard
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i knew there was some sort of function for that
    doh


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •