![]() |
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 :glugglug |
How about using count?
|
Quote:
|
that's:
select count(*) from table just incase you've never used it before |
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 :2 cents: |
Quote:
|
Quote:
|
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 :) |
Code:
$query = mysql_query("SELECT COUNT(*) FROM table")or die(mysql_error()); |
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 :) :thumbsup |
whats wrong with
select count(*) from table ? |
using count() is the most efficient way
|
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. |
All times are GMT -7. The time now is 01:52 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123