If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > could this code make a load??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-20-09, 20:31
hscorp hscorp is offline
Registered User
 
Join Date: Mar 2009
Posts: 11
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
Reply With Quote
  #2 (permalink)  
Old 03-20-09, 20:37
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Why don't you use count(*) if all you want to know is the number of rows?
Reply With Quote
  #3 (permalink)  
Old 03-20-09, 20:40
hscorp hscorp is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 03-21-09, 05:07
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
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?
Reply With Quote
  #5 (permalink)  
Old 03-21-09, 12:01
hscorp hscorp is offline
Registered User
 
Join Date: Mar 2009
Posts: 11
i just don't know how to do it
Reply With Quote
  #6 (permalink)  
Old 03-21-09, 12:06
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On