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

Collecting AOL Search Terms
I am attempting to collect AOL search terms. I know the code is correct (it works for google, bing,

JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w

Thought I has this figured out especially after all the help i received?
Cags, Salathe, Daniel helped me with this yesterday, but not sure i took it all in.
I am attempti

Weird problem with SELECT command..Help!
Hi!

It seems I'm having a really weird problem with SQL SELECT command....I have table into a

Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le

Login script (probably a simple error)
dbConfig.php
Code: <?
// Replace the variable values below
// with your specific dat

search query in mysql in php problem
my search query wont work, i know, that my codes are correct.please help

Code: [Select]&l

How to get variable value on next page
Hello friends
i am working on payentry page ..there i have this code.........

array_map() probably obvious mistake
The code below is part of a class to escape strings, but should also accept an array, using array_ma

simple ping code
been searchin the site/web and found code thats simple but doesnt work.

I have a personal we

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