Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

stat system

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

stat system

Postby Godiwa » Tue Jun 17, 2003 1:42 pm

ok I am lost in my own projekt here, and collecting all the info is so easy but how do I pull it out again and show it as I want it to be shown.

example here I have 3 refering urls (there will be many more) I want to find out how many different urls there is (in this case there is 3) and when I know how many different there is, then I at the same time want to know how many time EACH of the different urls is listed in the db

so first it finds the urls and dump the url string into vars $url1, $url2, $url3 etc etc depending on how many there is

next I want to find out how many times the different urls is listed and write it to vars like this $url_count1, $url_count2, $url_count3 etc etc.

how do I do all this? I am just pretty lost right now since it is so many things the script has to do at the same time, please help

Godiwa
Godiwa
New php-forum User
New php-forum User
 
Posts: 40
Joined: Wed Mar 05, 2003 5:55 am

Postby Skeletor » Wed Jun 18, 2003 9:11 am

I’m not sure how much info you want/need to retrieving info from a database. http://www.php.net/ is a great source to figure out how to do this. If you want more details, just write back and we’ll help out. What you might want to do is read in the urls from the database into an array. Once you have this array of urls, you can use the following php functions on the array:

Array_count_values( $array ) this function will count the values in the array, thus giving you a count of each url in the array.

Array_unique( $array ) this function will return an array with the duplicate urls removed. You can then use this new array to display them back to the user, or do whatever it is that you are doing with the urls.

Further descriptions of the functions can be found on http://www.php.net/ This should point you in the right direction. There may be a way to do the same thing w/ SQL, but the above is how I would go about it, depending what you want to do with the dataset once it has been returned.

Good luck
Skeletor
New php-forum User
New php-forum User
 
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio

Re: stat system

Postby WiZARD » Thu Jun 19, 2003 2:25 am

Use the MySQL database.....
all what you need just 3 field:
1 - date including,
2 - date last visit,
3 - date last change...
all you may manage form PHP
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.