Automatic increment a field in mysql [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I' building up a browsergame. I was wondering what is the best way to build up the "money" system. i no need anything "fast". I mean, the cash cuold be updated every day \ week. Is that possible doing it automatically? Like at 00.00 of every sunday it update automatically? Of course i need to update it every time someone buy something so it shuold be auto incrementing but still modificable with php query system!
Thanks a lot!

table wallets: id, user_id, amount
UPDATE wallets SET amount = amount+10
So you can call this query every week and it will increment all wallets by 10.
http://sqlfiddle.com/#!9/99dfe/1

Related

How can I create a list of top donors using php and mysql? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I would like to know how I can create a list of top donors, in which the user who donates the most is in the first position of the list.
In order to donate, you must be logged in
How can I do something like that using php and mysql?
This is only how much i understand your question.
First you need to create table for donors which the storage of their data, and 2nd is to make table for donate which holds the donator.
Then to sort the donator by donated the most, just use COUNT sql query to get the highest donate number.

Count the amount of users that are logged in [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am working on a school project. The assignment is to recreate our own version of Ebay. A requirement is to display the number of logged in users. What is the best way to do this? We are using PHP.
We are using a database so we could save the amount of loggins there but there is no proper way to decrease this amount since people often just leave the site without logging out.
Some suggestions would be awesome!
you could have a heartbeat script that updates a datetime on the user column.
and the show logged in users script could get all logged in users with time < 5 mins

Online voting system in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
My project is online voting system in php, requirements is that one user votes, So he will be able to vote only then after 4 years.
Sessions gonna work ?
No. Sessions only last as long as the browser remains open.
A better idea would be to post the data to a database with a timestamp. Then, when the user tries to vote again, the most recent vote timestamp by that user is drawn from the database.
If the most recent vote timestamp is > 4 years old, you can then allow the user to post again.

How to update day points everyday using php mysql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am having this project to update the data everyday and I just want it to update like realtime date everyday without opening the website like trigger or some timer in my database.
For example there like points system for bronze account there would be 1 points everyday how can I do that in php mysql thank you for the help
ill just find out the answer to my problem ill just use the MYSQL Event to update the points every day and let the date update everyday .

Deleting a specific row in SQL after dynamcic timeframe - PHP, MYSQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Hey so i need a way to remove a row that is connected to a user after a dynamic time. Eg: Insert that your doing something for 15 minutes, after that 15 minutes i want to delete that row automatically.
There will be lots of rows (users doing stuff) in the database and i need them to all be removed after a custom time for each that is set by the user.
How would i go about this!
Thanks in advannce
You will need 2 things.
a self_destruct_at or equivalent field that is a datetime. That will be set on creating the record.
a worker process to go through ever X minutes (probably 1) and delete the comments that are older than the current time and the created_at + self_destruct_at time

Categories