HOW TO GET HOW MANY RECORDS YOU HAVE IN DB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • auron

    HOW TO GET HOW MANY RECORDS YOU HAVE IN DB

    Hi,
    I finally discover the way how to get what I need.

    Let's look to my code:

    ----------------------- CODE ------------------------>

    $res = @mysql_query("S ELECT COUNT(*) AS ToT FROM table_name");
    $dato = mysql_fetch_arr ay($res);

    echo($dato[ToT]);
    ----------------------- CODE ------------------------>

    With this code you will get how much records do you have in DB.

    PS:
    Whan you think that everything is over and that you are at bottom of
    trying push harder to see what is under.

    Auron
    http://eye.cc php newsgroups
  • Michael Austin

    #2
    Re: HOW TO GET HOW MANY RECORDS YOU HAVE IN DB

    auron wrote:
    [color=blue]
    > Hi,
    > I finally discover the way how to get what I need.
    >
    > Let's look to my code:
    >
    > ----------------------- CODE ------------------------>
    >
    > $res = @mysql_query("S ELECT COUNT(*) AS ToT FROM table_name");
    > $dato = mysql_fetch_arr ay($res);
    >
    > echo($dato[ToT]);
    > ----------------------- CODE ------------------------>
    >
    > With this code you will get how much records do you have in DB.
    >
    > PS:
    > Whan you think that everything is over and that you are at bottom of
    > trying push harder to see what is under.
    >
    > Auron
    > http://eye.cc php newsgroups[/color]

    you should reply to your original post rather than starting a new thread!

    Comment

    • Kim André Akerø

      #3
      Re: HOW TO GET HOW MANY RECORDS YOU HAVE IN DB

      auron wrote:
      [color=blue]
      > Hi,
      > I finally discover the way how to get what I need.
      >
      > Let's look to my code:
      >
      > ----------------------- CODE ------------------------>
      >
      > $res = @mysql_query("S ELECT COUNT(*) AS ToT FROM table_name");
      > $dato = mysql_fetch_arr ay($res);
      >
      > echo($dato[ToT]);
      > ----------------------- CODE ------------------------>
      >
      > With this code you will get how much records do you have in DB.[/color]

      I can shrink that down to a single line, though:

      <?php
      echo mysql_result(my sql_query("SELE CT COUNT(*) FROM table_name"),0) ;
      ?>

      --
      Kim André Akerø
      - kimandre@NOSPAM betadome.com
      (remove NOSPAM to contact me directly)

      Comment

      Working...