URL description

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to create a ranking of pages visited in my site. So, every time
a page is accesed, I want to read the database and increased in + 1 the
field "visited" to the specified URL.

To do this, I need a variable with the URL. How do I give the variable
that value??



Re: URL description

zek2005 wrote:
Quoted text here. Click to load it

Why do you need a variable in the URL? Just knowing what the database
key is should be all you need.

If you using something like $_SERVER['REQUEST_URI'] as the primary key
in the database, then all you need to do is something similar to:

$query='UPDATE table SET count = count + 1 WHERE page =

Then, if the query succeeds but affected rows == 0, you'll need to do an
insert instead:

$query='INSERT INTO table (page, count) VALUES

However, before doing this consider the effect that a search engine
spider will have on the database... you may want to use some filtering
of how/when the queries are executed...

Justin Koivisto, ZCE - justin@koivi.com

Site Timeline