English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

// mysql info
include('config.php');

// How to parse count or other results from a query in php?
$sql = "SELECT * FROM test-table WHERE username LIKE '%test%'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query database', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);

From $row, how can I get a total number of a rows (count) from a query?

2006-09-24 21:37:30 · 3 answers · asked by only4u 1 in Computers & Internet Programming & Design

3 answers

amby darling here is your link.

http://www.google.co.uk/search?hl=en&q=in+php+total+number+of+a+rows+%28count%29+from+a+query&btnG=Search&meta=

2006-09-24 21:42:08 · answer #1 · answered by Joe_Young 6 · 0 1

/ mysql info
include('config.php');

// How to parse count or other results from a query in php?
$sql = "SELECT * FROM test-table WHERE username LIKE '%test%'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query database', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
echo " (". $row->count .")"; //here is the function

2006-09-24 21:45:03 · answer #2 · answered by gtgrgagsghgegr 2 · 0 0

$count extensive type = array_pop( mysql_fetch_row( mysql_query("decide on count extensive type(*) FROM comments_table") ) ) you may run the question "decide on * FROM comments_table" and count extensive type the rows it returns, although that is way less powerful with the aid of fact the database has to deliver each and all of the rows back.

2016-10-17 22:30:42 · answer #3 · answered by schrum 4 · 0 0

fedest.com, questions and answers