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?
Problem with creating FI documents
Hi, Experts!
Procedural to OOP
ohn Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO principles. I've started reading OOP tutorials including the design patterns. And John is right, this
How to show a complete textarea ??
I enter Client Case Notes notes in a textarea field on a PHP form. The field is 5 rows deep and 70 chars wide , using the scroll bar to see beyond 5 lines.After entering notes, I want to echo or print
BIG file upload!
Hey guys!I'm trying to upload a file, it works well with smaller files but with 60mb+, I get a POST size error even though I've raised POST max size:Code: ini_set( 'post_max_size', '500M' );This error
How to make URL loads only on login
On my page, when a user login he's redirects to user_home.php. I made it also to open the chat screen when the user login.This is the code:Code: // USER IS LOGGED IN, FORWARD TO USER HOMEif(
pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help here. Basically I got a basic pagination script from google search and the script works absolutely
Display Database
I need to create a shopping cart. I found this code online: http://conceptlogic.com/jcart/Unfortunately, I dont know how to display my product from MYSQL rather than hardcoding as shown in the script
Typedef struct vs just struct
Anyone know the rationale for using typedef for structs when a struct is itself a typedef? I have seen this in just about every book I have ever read, never with any explanation, yet I know from
WHYISNT THIS MYSQL STATEMNT NOT WORKING? (php)
caps because its absolutely rediculous.i dontunderstand why its not working. there is a column called id and a collumn called to then there is also. two rows with the field for `to` equal to the
preg_match logical error
Code: <?php$s = file_get_contents("page.html");preg_match('/<div class="brown_box main_ge_page vertically_spaced"><div