Jump to content

Automaticaly randomize data within a table?


RichterBelmont

Recommended Posts

I'm looking for a way to edit an SQL tables data automatically.  Sort of a loop that randomly edits a specific field within a given range.

I need every number within that field to randomize itself every hour, but within a given range/average. Each line within the table will also need its own specific range/average.

So lets say the the table is this:

Name        Id Number

Alex          1000

Tim          4000

Nick          8000

 

I'd want it to automatically update and change itself to something like this:

Alex      (Random number between 0-2000)

Tim      (Random number between 3000-5000)

Nick      (Random number between 7000-9000)

 

I'm assuming i need to use PHP for this and have it constantly looping this script every so often, and/or possibly running a server to update and edit these fields regularly. Any advice of any kind would be greatly appreciated. Even a name to what this process would be called so i at least have something to search for. Thanks again.

Link to comment
Share on other sites

Sorry to double post but i think i answered my own question. All i have to do is generate a smaller number and then multiply it by 100. The table data is hosted on my server is there a way to automatically run the script every hour within mysql? Like could i set the script to run and randomize the table every day at 12:30 pm? Again sorry for the double post and being a total noob. Thanks for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.