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

Comment Mod System Effects all rows...
Sorry if its confusing but here is whats going on: I have a table in a database called comments and

error reporting
hey everyone

I have a production server in which I want error reporting but only on some page

Connection Timeout
I'm using xmii 12.0

I'm calling a transaction as a web service from a windows application

Checking if multidimensional array is empty?
I have a for with multiple test input fields. Specifically the user submits multiple names and ages

is this the proper use of mysql_real_escape_string() to prevent sql injections?
i was wondering is this the proper use of mysql_real_escape_string() to prevent sql injections? any

Concatenate two strings ???
I have string one $string1 and another $string2.

How to concatenate (add) both of them $str

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

remove a ; from emails in textarea
Code: <?php

session_start();

$database_host = "localhost&qu

ereg_replace()
Basically what i need to do is

$title = "This Suck's"

$striped = ereg_repl

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