Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    26

    Unanswered: Checking record counts

    I am making an event sign-up form that asks only for the name and phone number of the registrant. Does anyone know of a PHP code that will check the MySQL database to see if there are 20 records inserted and if there is, not show the sign-up form any longer? Thanks!

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Hi
    You can fire a query to the database using mysql_query("select count(*) from table"), and then get this count to a variable say $count_records.
    Sample code
    $result=mysql_query("select count(*) as tcount from table_name");
    $a_rows=mysql_fetch_array($result);
    $count_records=$a_row['tcount'];
    Now check the value of $count_record and then execute you script.
    Hope this is clearer to you.
    If this doesn't serve your requirement, then get back with little more details.

    Regards
    Rajesh
    Freelance and Technology Consultant
    -------------------
    Dreams are for ever
    -------------------

Posting Permissions

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