Please delete your message, and start with a new thread.
Try and provide example code, or just the general flow done with comments on separate lines like below.
It will help you figure out what order to do things, and should help you explain it better on Code Project.
// Select lucky number(s) from last week (current_week -1)
// Select lucky number(s) from previous week (current_week -2)
// do this, *IF* *ELSE*
// do that, *IF* *ELSE*
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
Ok. It is so simple.