Forums »
  MySQL Forums And Topics Discussions About Open Source Database »
    How To Count Number Of Rows In A Mysql Query Get Total Count Rows

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
Posted On Mon Feb 18, 2008 By hostman In MySQL Forums And Topics Discussions About Open Source Database Forums
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
wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Wed Jun 19, 2013 (-8 GMT)
Powered by: Webune Forums V5