Hello!
I have a counter to count personal page views for users, but when the counter in the table is updated (incremented by 1)it also updates the date. Anyone know if the counter column can be updated without updating the date? Also, I need to have an update date for other updates.
Thanks

Recommended Answers

All 8 Replies

How exactly are you incrementing the counter?

mysql_query("UPDATE users INNER JOIN content SET counter = counter + 1 WHERE xyz = '$colname_Recordset1' ");

And which date is getting updated that you don't want? Are you referring to a column, or something else?

Thanx for your response.
In my table I have a column for a date. Every time a user updates his or her page the date gets updated. Also, every time someone else views his or her page a counter in the same table increments by one. The problem is that when the counter gets updated so does the date.

What I would like to do is let the counter increment by 1 without the date getting updated.

I tried to put the counter in the users table but then the counter in every row gets incremented by 1.

How do you update the date? It sounds like a matter of separating the two.

I set the db column to update current time stamp.

Then you'll need to change the column type. You can just make it a regular int, then if you want to update the time, use something like this:

$time = time();
$query = "UPDATE Table SET time='$time' WHERE condition='mycondition' ";

Ok I'll try that. Sounds good, Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.