• home
  • forum
  • my
  • kt
  • download
  • Counting records in PHP/mySQL

    Author: 2007-08-11 12:12:42 From:

    Following code samples, demonstrates how to count records in a MySQL database table. You may send parameters to query to display only selected range of rows.

    <?php
     
      mysql_pconnect($server, $username, $password);
      mysql_select_db("articles_index") or die("Can not find database");
      
      $query = "select * from articles where catID = 4";
      $result = mysql_query($query);

      while ($row = mysql_fetch_array($result))
      {
       $count = $row["count"];
      }
     echo $count;

    ?>


    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Ad Management (4)
      Calendars (3)
      Chat Systems (7)
      Content Management (6)
      Cookies and Sessions (8)
      Counters (8)
      Database Related (8)
      Date and Time (9)
      Development (6)
      Discussion Boards (7)
      E Commerce (6)
      Email Systems (9)
      Error Handling (5)
      File Manipulation (10)
      Flash and PHP (4)
      Form Processing (7)
      Guestbooks (8)
      Image Manipulation (3)
      Installing PHP (5)
      Introduction to PHP (9)
      Link Indexing (6)
      Mailing List Management (8)
      Miscellaneous (10)
      Networking (6)
      News Publishing (6)
      OOP (8)
      PEAR (6)
      PHP vs Other Languages (2)
      Polls and Voting (5)
      Postcards (0)
      Randomizing (8)
      Redirection (8)
      Searching (6)
      Security (6)
      Site Navigation (7)
      User Authentication (10)
      WAP and WML (7)
      Web Fetching (0)
      Web Traffic Analysis (11)
      XML and PHP (0)

    New

    Hot