How To Count Number Of Rows In A Mysql Query Get Total Count Rows
Description: How To Count Number Of Rows In A Mysql Query Get Total Count Rows
Tags: how ,to ,count ,number ,of ,rows ,in ,a ,mysql ,query ,get ,total ,count ,rows
lets say you want to get the total number of queries in a mysql database.
for example, i have a forums and i want to know how many replies the topic number 455 has recieved, i can use this:
$sql = "SELECT COUNT(reply) WHERE topic='455'"
$row = mysql_fetch_row($result);
$count = $row[0];
TEMPLATE:
$sql = "SELECT COUNT (field) WHERE field='$velue'"
$result = mysql_query($sql ,$db);
$row = mysql_fetch_row($result);
$count = $row[0];
emmypro Tue Jan 10, 2012 nice one...needed that
flander Mon Jul 28, 2008 really good, i will try it
hostman Mon Feb 18, 2008 this is anoter one i use
$db = mysql_connect("HOSTNAME", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE_NAME",$db);
$sql2 = "select count(id) from ".$db_prefix."wallpaper WHERE status = '".$_GET['show']."'";
$result2 = mysql_query($sql2 ,$db);
$row2 = mysql_fetch_row($result2);
$num_of_items = $row2[0];
$start_reply = ($page_num * $replies_per_page);
$total_pages = ceil($reply_numbs/$items_per_page);
Information
Title: How To Count Number Of Rows In A Mysql Query Get Total Count Rows
Info: This Post Has Been Viewed 0 Times Since
Date: Mon Feb 18, 2008
Author
hostman Received 3 Replies #889
Related Content
Related Pages
Related Sites
Add Your Website
Share
URL:

Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
Embed:

To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it
BBCODE::

BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums