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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-19-2004, 02:23 PM   #1
MichaelP
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
MichaelP is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 02:24 PM   #2
AndrewKanuck
Confirmed User
 
Join Date: Jan 2004
Location: Cleveland & Atlanta
Posts: 6,706
How about using count?
__________________
AndrewKanuck is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 02:25 PM   #3
lilj
Confirmed User
 
Join Date: Dec 2003
Posts: 1,536
Quote:
Originally posted by egonetworks
How about using count?
__________________

Does your network need a Reality Check? [ Find Out ]
lilj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 02:25 PM   #4
AndrewKanuck
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
__________________
AndrewKanuck is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 02:28 PM   #5
cjnet
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
cjnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 03:09 PM   #6
MichaelP
Registered User
 
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
Quote:
Originally posted by cjnet
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
Thank you but i tried it and it doesn,t work... Maybe if I can just show the highest ID from the db it would be ok too
MichaelP is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 03:13 PM   #7
JSA Matt
So Fucking Banned
 
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
Quote:
Originally posted by egonetworks
select count(*) from table
if that's not the answer, we don't understand the question
JSA Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 03:16 PM   #8
MichaelP
Registered User
 
Industry Role:
Join Date: Aug 2003
Location: QWEBEC Corporate Office
Posts: 7,124
Quote:
Originally posted by JSA Matt
if that's not the answer, we don't understand the question
Ho you REALLY WELL understood it, it is just that I tried this nad it didn,t work.. Sorry guy I am not very used with MySql queries yet

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
MichaelP is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-19-2004, 03:29 PM   #9
JSA Matt
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;
JSA Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-20-2004, 07:21 AM   #10
MichaelP
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

MichaelP is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-20-2004, 07:23 AM   #11
s9ann0
Confirmed User
 
Join Date: Sep 2001
Location: Boston
Posts: 4,873
whats wrong with

select count(*) from table

?
s9ann0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-20-2004, 07:42 AM   #12
Ash@phpFX
Confirmed User
 
Join Date: Nov 2003
Posts: 4,292
using count() is the most efficient way
Ash@phpFX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-20-2004, 08:17 AM   #13
WombRaider
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.
WombRaider is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.