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

Passing JS to PHP
So I have the following
Code: <?php
getdetails(?><script type="text/

session checking in page load
hai all I have a web site is www.Mryas.com in this my login page is Page1.aspx its co

PHP IMAGE UPLOAD SCRIPT
Hi for the last week i have been looking for scripts that will upload a photo to a certain folder wh

breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this:

abc

Simple image grab script.
I was wondering if it was possible and if anyone knew how to make a simple php script that looks at

Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,

Get keys and values from an array
Hellow,

I have an array $Data with keys and values. With a foreach I can display all the valu

set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli

import table with dependency
Hi

What is the best way to import table back which has dependency?

SQL> cre

Beginner question regarding Array's
Hi everyone, the page im working on has an array of variable at the top...

Code: $define_li

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