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");
$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

GIS appliction help
I found some tutorials in the internet to develop a map application I don't want to use google maps

need help in dynamic select menu in php
hi i have created a dynamic select menu using php. i have a problem in that which is when the user s

word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: function createthumb($name,$filename,$n

my sql select id and then update problem.
I need to select some auto incremented ids out of a database and then use those id in a where statem

Image resize
Hi again fellers

I managed to sort out the issues with the folder,

Final hurdle is th

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

Security Exception on pages using AJAX
I am getting the exception: attempted to perform an operation not allowed by the security policy on

Files in current folder. Should be an easy fix.
Never mind. I've asked about this before and just found my answer. Anyway to delete this?

show the direct link into href
I want to display link on the page. i am fetching the data(URL) from database,actually before that i

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