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>';
}
?>