sql results, How to count points for duplicate names for each name in php code -


i have sql table in website

nourena

note : want edit php code

<?php     // make connecion  mysql_connect('host', 'host user', '');    // select database  mysql_select_db ('database name');    $sql="select * database_name";    $records=mysql_query($sql);        ?>    <html>  <head>  <meta http-equiv="content-type" content="text/html; charset=utf-8" />  <title>الاحصائيات النهائية لمسابقة اكتوبر</title>  </head>    <body>    <table>  				  			<tr>  				<th style="width: 40px;">pos.</th>  				<th style="">name</th>  				<th style="width: 60px;">points</th>  			<tr>  <?php      while($database_name=mysql_fetch_assoc($records)) {  	   	 echo "<tr>";   	   	 echo "<td>".$database_name[toplist_id]."</td>";   	   	 echo "<td>".$database_name[name]."</td>";  	   	 echo "<td>".$database_name[points]."</td>";  	   	 echo "</tr>";   	   	   	 }// end while    ?>                                              		  	</table>    </body>  </html>    <?php     ?>

as see in table have duplicate names beltagy , points name.

i want count points each name , show name out duplicate.

also want rank names ".pos " in table according on receipt of number of points each name

now show table this

.pos    name      points    1     beltagy     9   2     test        8 

please newbie , need , , sorry little english

alter query this:

$sql="select toplist_id, name, sum(points) totalpoints       database_name       group name       order sum(points) totalpoint desc"; 

** 'database_name' should table name, have used 'database_name' in original question.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -