![]() |
help for (for)
<? i don't know what is wrong with this one i want the output to become this one 1 2 3 4 2 3 4 1 3 4 1 2 4 1 2 3 i really kinda new with this thanks a lot guys guys can you help me out with this one.. :icon_redface: |
Re: help for (for)
Couple of things, firtsly could you use code tags to place code in a post.
Secondly welcome to the forums. OK one of your first problems was your initial for statement had seom variables named wrongly :
then there were a few other problems to such as at no point were you specifying to start from any number other than 1, so it would always count from 1-4. you were also echoing the value of cchk for no reason. here is the code i come up with not the best for many reasons, such as im not a great programmer/scripter plus i don't know the PHP language but here it is anyway :
As you can see i also check to see if x goes above 4 if so it returns it to 1, this ensure that it doesn't produce this outcome 1234 2345 3456 4567 Also this is unchecked but to make this work for any number of rows, so the highest number = the number of ros simple change this :
Hope this helped if you need anything else just ask. |
Re: help for (for)
This is a bit more memory intensive and slower as well, but I like how it works:
:
|
| All times are GMT -5. The time now is 5:01 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC