PHP Classes

Ordering by

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Ordering by  
Subject:Ordering by
Summary:order pol results
Messages:2
Author:Astonn
Date:2014-09-27 18:20:41
Update:2014-09-27 22:00:06
 

  1. Ordering by   Reply   Report abuse  
Picture of Astonn Astonn - 2014-09-27 22:00:06
I'm was working with asp and now I have to do something in php so because I'm new to php I stuck into problems. I'm working at some pool, top-chart script. I found few free script and i'm trying to adapt it for my needs.
Here is the problem. I need to order songs by number of votes. Data are stored in txt.file like this

Artist and song title:12

where 12 is number of votes, and here is part of my code

<?php
$rawdata = file('results.txt');
$count = 0;
foreach ($answers as $value) {
if ($value['text'] == $_POST['polling']) {
$answers[$count]['count'] = ((int)$value['count'])+1;
(int)$totalCount++;
}
++$count;
}
writeData();
foreach ($answers as $value) {
echo '<tr><td> '.$value['text'].'</td><td>'.$value['count'].'</td></tr>';
}
?>

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.