PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've made a script for rating downloads, when people open a certain page they are able to rate the download and they get an average rating after they vote. Now i want to put up all the averages on another page to show them. How can i do this with the following script:
The main File:
And all the votings go into a file, in the above script that is rating.dat. But for other ratings there are other *.dat files to contain the data of that rating.
And i want to put the averages ($gem variable) of more than one rating on one page. How can i do this??
Last edited by killkenny on Tue Jul 02, 2002 3:41 am, edited 1 time in total.
I'm just going to point out some things you have in your code that might give you headaches later on:
Why variable names like cijfertjes, aantal and gem? That's completely confusing for anyone looking at your code, and yourself if it gets too complex. How about vote_array, array_size and avg_rating?
Use the [syntax=php][/syntax] tags when putting your PHP script up, it saves the formatting.
$fp=fopen("rating.dat",a); should be $fp=fopen("rating.dat","a");
Why variable names like cijfertjes, aantal and gem? That's completely confusing for anyone looking at your code, and yourself if it gets too complex. How about vote_array, array_size and avg_rating?
The variable names are the dutch words for what it does, i know it might be confusing for other people, but for me it's easier to look at. For the other people, here is a translation of the words:
cijfertjes: The rating that was given.
aantal: The number of times people voted
gem: The average rating