Smudly Posted June 14, 2010 Share Posted June 14, 2010 Hi, I am attempting to create a script that will give each row inside my database (each one contains a website url) a random value from 1 to the total number of rows in the table. Once each one is set, my script will go to the row with the value that has been set to 1. If that row's active status is == to Yes, and it's Credits > 0, the website will be selected to be shown to the user. If not, it will skip that row, and do the same checks for Row 2. I'm having difficulty figuring this out. Quote Link to comment Share on other sites More sharing options...
beta0x64 Posted June 14, 2010 Share Posted June 14, 2010 What are you having trouble with figuring out? It certainly sounds like you know what you want to accomplish. I would start out by working through your code in pseudocode. That is, connect to mysql connect to db if table not exists create table numrows = number of rows foreach row in table row = random_number() for i=0;i < numrows;i++ mysql(select status, credits from table where value = i) . . . then figure out what you need to work on to make it happen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.