![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 1
Rep Power: 0
![]() |
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.. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
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 PHP Syntax (Toggle Plain Text)
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 PHP Syntax (Toggle Plain Text)
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 PHP Syntax (Toggle Plain Text)
Hope this helped if you need anything else just ask.
__________________
Who said i couldn't program sarcasm = raw_input('Type in a sarcastic remark: ')
Last edited by Freaky Chris; Mar 28th, 2008 at 6:30 AM. |
|
|
|
|
|
#3 |
|
King of Portal
|
Re: help for (for)
This is a bit more memory intensive and slower as well, but I like how it works:
php Syntax (Toggle Plain Text)
__________________
You are here to serve the board. So post well... and live. SPAMMING SPEED! GrimBB |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|