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

I need desperate help with this php code integrated with flash please
Can someone please help me with this php code which I have been stuck on for weeks . I am trying to

Storing user data help?
Hey Guys,

I'm not use if this question is to broad but I can always give you more informatio

MS Access data into a html table
Hi everyone, I am quite a novice at php but I have created some helpful scripts that fetch data
f

Multiple if statements
Ok so seems basic but for some reason I'm not doing it right. What I want is to be able to have 2 se

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

division gives infinity anser
int main()
{
int z=0;
int i=1/z;
cout<
}

It doesn't throw a

Unidentified index error in a simple form
I have been trying to make an HTML form that is handled by a PHP script. So far my attempts to get i

if description does not contain the following words
Hello everyone,

I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa

Dump with added_funcion cl_salv_table
Hi there, I'm having some troubles adding a self defined function to an ALV in fullscreen. The thing

RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?

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