getting most records by count


Posted on 16th Feb 2014 07:03 pm by admin

Code: [Select]<?php

$connect = mysql_connect("localhost","damgears_evil","damgears");
mysql_select_db("damgears_evil");
Did you know?Explore Trending and Topic pages for more stories like this.
$queryreg = mysql_query("SELECT COUNT(*) FROM titles WHERE fname = '$fname' && lname = '$lname' ");
while($row = mysql_fetch_assoc($queryreg))
{
$amountitles = $row[0];
$dbname = $row['fname'];
echo "$amoutitles $dbname";
}
?>


Basically what i want to do is if ther is a record

Jeff Smith
Jeff Smith
Jeff Smith
John Adams
John Adams
Susan Adams
Jeff Smith

I want it to count it and order it by count so the person with the highest amount of records then displays

$amounttitles - $dbname

and limit to top 10.

thanks
No comments posted yet

Your Answer:

Login to answer
92 Like 46 Dislike
Previous forums Next forums
Other forums

Is it possible to view php source code??
Hi All

I was just wondering if it's possible to view a websites php source code?
I know

Filtering Tables
Hello Thanks for any help any one can give Im very new to PHP..

I need to pull data for clien

trim function issues
Hi guys, total noob here...

So I've been tinkering around with a html and am using php to em

Insert Failing.
Hey,
I am making a Sign up page for a website, but the insert query into the Database does not se

Warning: mysql_num_rows() expects parameter 1
When i add quote at the end of this link
example:http://localhost/articlemania/category.php?cid=3

How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

I would like "for" to wait 5 sec
I would like my 'for' loop to wait 5 sec before second iteration.


for ($i=0; $i<10

Convert Binary String to Decimal
Trying to Get:
Decimal: 305419896

Out of:
Binary String: xV4

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash