473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

URL description

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??

Thanks!

Ezequiel

Jan 9 '06 #1
1 1326
zek2005 wrote:
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??


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 =
\'.mysql_real_escape_string($_SERVER['REQUEST_URI']).'\'';

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

$query='INSERT INTO table (page, count) VALUES
(\'.mysql_real_escape_string($_SERVER['REQUEST_URI']).'\',1)';

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 - ju****@koivi.com
http://koivi.com
Jan 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Larry Bates | last post by:
Anybody know what variable I need to define in my class to set the long description that shows up in the Services control panel applet? _svc_name_ holds the short name...
28
by: Atanas Boev | last post by:
I have a heading that I would like to link to site section, in the following context: <h1>Site Contents</h1> <h2>First Section</h2> <h2>Second Section</h2> <h2>Third Section</h2> I want...
4
by: fxparlant | last post by:
Hello, I didn't find a specific newsgroup for HR-xml, excuse me for posting here. Can I build a resume with several "description" tags, one for each language ? Or should I start a whole...
3
by: sparks | last post by:
I was copying fields from one table to another. IF the var name starts with milk I change it to egg and create it in the destination table. It works fine but I want to copy the description as...
2
by: Dennis Ruppert | last post by:
I created a routine to read and edit the description properties of tables, (the one you see in the database window). It works just fine. This is the basic code behind it, I substituted all my...
8
by: doomx | last post by:
I'm using SQL scripts to create and alter tables in my DB I want to know if it's possible to fill the description(like in the Create table UI) using these scripts. EX: CREATE TABLE(...
4
by: Joe Fallon | last post by:
If I have an Enumeration can I give a text description for each value? e.g. something like Public Enum Colors Black "Really cool Black" Blue "Ice Cold Labatts" End Enum
4
by: Bob | last post by:
Hi all, I write the description of a lot of my tables and queries in the description section in the properties (when you right click on the table or query). Is there a method or a property that...
4
by: louishong | last post by:
i'm uisng a master database that has hundreds of tables and links. i would like to create a clean mdb file and only import/link tables from the master database where the description column is like...
2
by: brett | last post by:
ok, it appears that i have run into a spot that i am not able to figure out on my own. Let me first say that i have hobbled together this SUB from things i found on the internet and tutorials....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.