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

upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t

Advice on how to delete a mysql row using my form
Hi,

I am very new to php and am struggling to work out how to delete a portfolio item (a row

extract a file from zip file
hi,
i know how to unzip a zip file in php, but is there a way to just extract a certain file only

Help with Password Encoding/Decoding?
Trying to design a "change password" tool. On my signup code I'm using base64_encode, now

Casting Decimals in Oracle
This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Ora

form help
this doesn't work. i want the form action to go the location.href of the submit button chosen.. how

Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie

Parse Error
Hi Guys,

I have a function in my class which returns a string link variable. The problem is i

IIS on 2003 anon access disabled issue
I have an IIS server that belongs to a domain, and anonymous access is turned off for all my sites.

Format String help
I have a textbox where a person enters an application number. the application number is 10 characte

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