ok i'm trying to create a top ten list from a database of listed favorite movies.
the following code yields me the correct order and number of votes for each movie
$compare = array_count_values ($anfo);
arsort($compare);
print_r($compare);
Array ( [] => 518 [pulp fiction] => 8 [fight club] => 8 [harry potter] => 7 [zoolander] => 7 [dirty
dancing] => 6 [ notebook] => 6 [mean girls] => 5 [juno] => 5 [300] => 5 [garden state] => 4 [a walk
to remember] => 4 [v for vendetta] => 4 )
I want to code things so that the above list is formated like a top ten list like so...
top movies
1 pulp fiction - 8 votes
2 fight club - 8 votes
3 harry potter - 8 votes
4 zoolander - 7 votes
5 dirty dancing - 6 votes
6 notebook - 6 votes
7 mean girls - 5 votes
8 300 - 5 votes
9 garden state - 4 votes
10 a walk to remember - 4 votes
what do i need to do to make that happen?
i tried
top 10 list
1. <?=$compare[1]?>
2. <?=$compare[2]?>
3. <?=$compare[3]?>
but that didn't work
update.... i just figured out the that i needed to use
$compare2 = array_keys($compare) ;
so that gives me the movie names, now i just need to figure out how to access the count values. any ideas?
Help with form post data and arrays
Hi all,I am new to this forum... It has been awhile since i have worked with arrays, and i am starting to pull my hair out with this little issue i am having..I hope someone can help me out with it,
MII Trends - add data onto chart object
Hello,
Output Full URL of Current Page
Let's say I am currently viewing a dynamic page: http://www.mydomain.com/directory/index.php?type=flowers I want this URL to be output on the page, but not including the end parameters.
Alternate messaging
I have 4 strings in MySQL db1$string1 : Hello$string2 : Hi$string3 : Great$string4 : ThanksAnd I have 3 accounts MySQL db2$User1 : $Pw1$User2 : $Pw2$User3 : $Pw3expected result---------------Hello
Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:QuoteBlah blahBlah blahetcbut when i echo it out, there is no formatting left it comes out as:QuoteBlah blah Blah blah etcis there an easy way to stop this?
Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and some links . but those sessions are not working correctly when some one sign in and sign out and
finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");$rc = 1;while(!feof($openedfile)){$rc++;$hold[$rc] = explode("|" , trim(fgets($openedfile)));}fclose($openedfile);How can I loop through
filesize problem
i use ubuntu 9.10 and i have mountet a folder from an windows/mount/FOLDER/mount/FOLDER/FILE.txti try to find out the size of folder : FILE.txtPHP Warning: filesize(): stat failed for
help with multi-update
Now sure how to ask this really....
Multiple arrays inside data
Hi,Simple question. I have a column called "array" in my database, and inserted into each field is the following imploded array:Code: mctriangle,570.65,355.1,1,1,0It is an instance of an