Reply to Re: Urgent help for quiz ranking logic

Your name:

Reply:


Posted by Jasen Betts on 02/19/06 03:08

On 2006-02-18, Kapil Jain <kapiljainindore@gmail.com> wrote:
> Dear All,


> Please help me urgently....
>
> below is the test code

try this...

I also modified the SQL to do fewer uodates... if all who score '10' get rank
1 then all uppdates can be done in one query.


><?
> if (!isset($submit))
> {
> $sql ="select pkey,total from `quiz_percentile` order by total desc";
>
> percentile = mysql_query($sql) or die (mysql_error());
> $i=0;

$rank='-1' ; $score=-1;

while ($rs = mysql_fetch_array($percentile))
{
//echo $rs["total"]."This is total"."<br>";
$i++;

if($score != $rs['total'])
{
$rank=$i;
$score=$rs['total'];
$sql_insert = "update quiz_percentile set rank='$rank' "
."where total='$score' ;" ;

$arr = mysql_query($sql_insert) or
die(disp_message(mysql_error(),"javascript:history.back()"));
}
}
> ?>
></body>
></html>
>


--

Bye.
Jasen

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация