Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2009
    Posts
    11

    Unanswered: could this code make a load??

    PHP Code:
    <?
                        
                        
    require 'includes/db.inc.php';
                        
                        
    $resultfiles mysql_query("SELECT * FROM file");
                        
    $num_rowsfiles mysql_num_rows($resultfiles);
                        
                        echo 
    "$num_rowsfiles Files\n &amp; \n"
                        
                        
    $resultmirrors mysql_query("SELECT * FROM mirror");
                        
    $num_rowsmirrors mysql_num_rows($resultmirrors);
                        
                        echo 
    "$num_rowsmirrors Mirrors\n";
                        
                        
    ?>
    the number or rows about 4000 each table

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Why don't you use count(*) if all you want to know is the number of rows?

  3. #3
    Join Date
    Mar 2009
    Posts
    11
    I'm not experienced in db stuff so i couldn't make it with count(*)

    but the problem not how to make it the problem is that the host company suspended my site because of a page just contain this code no more queries in this page so i wonder could this be the cause?

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by hscorp
    I'm not experienced in db stuff so i couldn't make it with count(*)
    Why? What's preventing you to change the queries?

  5. #5
    Join Date
    Mar 2009
    Posts
    11
    i just don't know how to do it

  6. #6
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    To get the count of all rows in a table use:
    Code:
    select count(*) from the_table
    More details in the manual:
    ]MySQL :: MySQL 5.0 Reference Manual :: 12.2.8 SELECT Syntax

Posting Permissions

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