![]() |
Never ending increment?
I probably sound like a noob for this cause I never tried it. :P
Usually when incrementing, it only increments by one, but I want it to keep incrementing. PHP Code:
|
Im not sure what you are trying to do, if you want to incriment a variable by more then one
PHP Code:
|
can you do some kind of select
PHP Code:
|
Quote:
Also, when a user clicks on say an id on a page, then it increments the views column by one, and is displayed on the page. |
I dont think there is a way to do that.
|
Quote:
|
You can more likely do it using Ajax seems simply enough
|
I'm not entirely sure what you are trying to do, but in your original code, the reason it only increments it to 1 is because you are resetting the variable to 0 before you increment it.
I'm guessing that you want to do something like vBulletins thread views counter. The general idea is to get the number of views (ie, from a database), increment it by one, then store the new value back in the database. If you wanted to update the page instantly, then use Ajax as Rendair suggested after you have read/write the values to the database. Alan |
What are you attempting to do? Reading your post again, it really doesnt make any sense.
|
I'm trying to increment every time there is a new view, a view is when someone goes onto a special page, and then it inserts the view into the mysql, and shows it on the front page. This is what I want for my image uploading script.
|
Code:
UPDATE table |
Quote:
php Code:
So instead we use the following: php Code:
|
Quote:
|
PHP Code:
|
You can make it update the page instantly without having to refresh using something like this. You create 2 pages on with that script ReSpawn said or whatever and then the main page where you have some kind of onClick or something.
PHP Code:
PHP Code:
This example has a use of a hidden field containing the id then you can use the MySQL on a new page. PHP Code:
|
Yeah, then you're using the AJAX framework. There are a lot of plugins for it if you're into it. Check out mootools.net Orc. :)
|
It keeps saying on Gmail, that Village Idiot replied to this thread. :/
|
What do you mean? If you mean it gets the same ID over and over, you should make the $_GET['post'] or what ever dynamic.
|
Quote:
|
Orc, if you want us to help you, you need to help us. What are you trying to do? We dont understand what you have previously said. If we know what you are trying to accomplish we could probably tell you how to do it.
|
| All times are GMT. The time now is 12:44 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0