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

PHP Surveys
I really would like some advice.

If you have a client come to you asking for a survey to be d

Linked Keywords
I am trying to get a script that makes my predefined keyword converted to links and / or converted t

data type in column definition
Hi,
I create a table with column called "Direction of Travel code ".
The travel codes in t

PHP Script runs on CLI but not through web browser
I am running into an issue that I just can't seem to find the answer to. I have a Windows Server 200

Matchcode in ALV change header column
Hello everyone,

I am working in an SAP system that is currently in upgrade and conversion

Navigation include for all site directories
Hi,

I need a navigation include that can deal with directories at different levels on a site.

Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't unders

Add code to enable passing of checkbox variable on login
Ok, I have a login page, but want to add a checkbox that when checked and successful login is made i

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

send() and recv() parameters confusion
On server Side:
int recv (Socket,Buffer, Length, Flags)
On Client Side:
int send (Soc

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