Scottshane
asked on
UPDATE multiple rows with loop
I have the table 'addr_im' that was altered by Adding a datetime field called 'date_create'.
There are 1753 rows
I need to populate the 'date_create 'with a random Date in the last month
USING THIS FRO THE RANDOM DATE
$ranDate = date('Y/m/d h:m:s', mktime(rand(0,24),rand(0,6 0),rand(0, 60),10,ran d(1,30),20 06));
I need to loop through each row and update 'date_create' with $ranDate
There are 1753 rows
I need to populate the 'date_create 'with a random Date in the last month
USING THIS FRO THE RANDOM DATE
$ranDate = date('Y/m/d h:m:s', mktime(rand(0,24),rand(0,6
I need to loop through each row and update 'date_create' with $ranDate
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How is my answer wrong? - it is more complete than voteys and gives you for october as you wanted.
?
ASKER
There are no comments in this thread stating that you answer's wrong.
His was the answer I chose.
and his mistake actually worked out to my advantage.
the end.
His was the answer I chose.
and his mistake actually worked out to my advantage.
the end.
Well,
The policy is if an answer is correct then the first correct answer should be given the points - or they should be shared.
The fact that my answer was correct and first and you did not accept it or give points for an assist means that it is incorrect - according to EE policy.
This is why I wanted to know why it was wrong - otherwise it should have been graded accordingly.
The policy is if an answer is correct then the first correct answer should be given the points - or they should be shared.
The fact that my answer was correct and first and you did not accept it or give points for an assist means that it is incorrect - according to EE policy.
This is why I wanted to know why it was wrong - otherwise it should have been graded accordingly.
ASKER
Ok, my bad I didn't read the Policy.
Is there a way to grade yo post facto?
If I can do that I will.
Is there a way to grade yo post facto?
If I can do that I will.
Hi, you could post a requrest in the community support forum for the question to be re opened for grading.
You do not have to if you do not want to - I just do not like putting the effort in for a correct decision and then having it disregarded for one that is near identical - this was the third time it has happened today so that is why i was a little snappy - I apologise
You do not have to if you do not want to - I just do not like putting the effort in for a correct decision and then having it disregarded for one that is near identical - this was the third time it has happened today so that is why i was a little snappy - I apologise
I did want to add: databases are really good at doing loop-like stuff natively. Any time you're thinking of writing a loop it's worth considering an SQL approach that will do the same thing. It's certainly not a universal truth, but it's a pretty good bet that one exists.