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

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

adding up might be solved tell us cheers.
i think i finally solved this anybody.

last time i was getting the wrong results.

Code

textfield unchanged
hi,
i want my form to know whether its textbox is unchange or not.

if($textbox == 'unchang

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

Call db table from any PHP file
Hi,

I want to be able to call a database table that will be setup in another file called init

How to secure my login data to my database?
Hi there,

It may be a stupid question but I don't know how to secure my login data to my data

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

php include email form with attachment
I have had no luck with finding a email form all over the Internet for various reasons. Some insecur

Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav

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