![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Registered User
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
|
MySql dumb question (maybe) :)
Is there a simple way to show how many entries from a database ?
like " select * FROM thistable limit= total,1..." well you get the idea ![]() Thnaks in advance ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Jan 2004
Location: Cleveland & Atlanta
Posts: 6,706
|
How about using count?
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Jan 2004
Location: Cleveland & Atlanta
Posts: 6,706
|
that's:
select count(*) from table just incase you've never used it before
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Registered User
Join Date: Mar 2004
Location: i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money i like to make money :)
Posts: 281
|
not really i don't think..
in php the easiest way would be: $query = "SELECT * FROM TABLE" $result = mysql_query($query) or die("Failed to Get Crap"); $count = mysql_num_rows($result); i'm pretty sure.. if that helps =O ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Registered User
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
So Fucking Banned
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Registered User
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
|
Quote:
![]() include_once("sql_include.php"); /= this is where i connect to DB $sql = "SELECT count(*) FROM tblEntries"; $result = SQL_Query($sql); echo $result ; I know I am not that far but not there yet ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
So Fucking Banned
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
|
Code:
$query = mysql_query("SELECT COUNT(*) FROM table")or die(mysql_error()); list($rows) = mysql_fetch_row($query); echo $rows; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Registered User
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
|
Ok got it
include_once("sql_include.php"); $sql = "SELECT * FROM thistable ORDER BY id DESC LIMIT 0 , 1"; $result = SQL_Query($sql); while($row = mysql_fetch_array($result["ResultSet"])) { print "" . $row["id"] . "" ; } Thanks to all for your help. it is very appreciated ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Sep 2001
Location: Boston
Posts: 4,873
|
whats wrong with
select count(*) from table ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Nov 2003
Posts: 4,292
|
using count() is the most efficient way
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Sep 2002
Location: FL
Posts: 159
|
Here's another way that's worked for me:
$query = mysql_query("SELECT * FROM tableName"); $qty = mysql_num_rows($query); echo $qty; Hope that helps.
__________________
Fred, I think I fried the motherboard.........and the fatherboard, too. |
![]() |
![]() ![]() ![]() ![]() ![]() |