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

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

Prevention Help
How can I use PHP or any other language (feel free to move this thread) to prevent users doing scree

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?

here is my code

dinamic "textboxes"?
Ey all, my first post here, i hope its not a hard one

I display mysql results in a table

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

I need to pull data for clien

Points for Wiki contribution
Hi everyone,

I want to know how long does it take for the moderator to award points for a

Significance of BPM
Hi Experts,
I am a novice in BPM , I just want to know how BPM as permenant department is

New to PHP and just trying to understand a little code.
I hope I'm not annoying anyone or breaking the rules but I was wondering about this bit of code righ

How do I give a developer access to a specific directory and nothing else?
I want to give a develop access to a specific directory and nothing else

I can give them an F

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