开发者

Using only once and start from beginning again

开发者 https://www.devze.com 2023-02-19 13:02 出处:网络
Here is what I am trying to accomplish: I have 500 usernames in my database. For each username in my database, I want to start from the first username, and call a function 10 times.

Here is what I am trying to accomplish:

I have 500 usernames in my database. For each username in my database, I want to start from the first username, and call a function 10 times.

So example,

  1. username1 - function called.
  2. username2- function called.
  3. username3- function called.
  4. username4- function called.
  5. username5- function called.
  6. username6- function called.
  7. username7- function called.
  8. username8- function called.
  9. username9- function called.
  10. username10- function called.

Now we left off at username10, if I wanted to continue from username10 another day, how can I do this? I know you can add a new column to the database saying used and set it to '1' but, what if I did all 500, and want to start back over from username1 again? How 开发者_如何学Gocan I do this?

Also when I am calling a function for each username, how can I log the process like above into a iframe?


If you want to use the "used" column method, here's how you set every user to unused:

UPDATE `mytable` SET `used`=0;

I don't know what you mean by "log it to an iframe", but you could log all of the operations to a file, with fwrite - here's the documentation.

Edit:

Select all entries from table that have `checked`=0. For each of these entries
    Execute the functions you need to execute
    Set `checked`=1

When you want to start over

Set `checked`=0 for all entires. Execute code above.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号