Loop - Convert number into day of the week

06-27-04, 06:55 AM
|
|
Coding Addict
|
|
Join Date: Jan 2004
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Loop - Convert number into day of the week
I have this following Loop.
'. $night['iddays'] .' results as a numerical number. 0, 1 , 2 , 3, 4 etc up to 6. Each number representing a day of the week. 0 = Sunday, 1 = Monday, 2= Tuesday etc 6 = Saturday.
The script below only shows the numerical result. How can I convert the numbers so it will show the day of the week.
|

06-27-04, 10:18 AM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
enjoy 
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

06-27-04, 05:14 PM
|
|
Coding Addict
|
|
Join Date: Jan 2004
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Man, it seems so obvious when you see it. Thanks again NM
|

06-27-04, 05:59 PM
|
|
Coding Addict
|
|
Join Date: Jan 2004
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
another little question on this: How could I get the dates of that day for a selected month. i.e
if 0 = Sun then how can I get all the Sundays of a selected month
The script below is a attempt from another system i had. I'm sure its complety worng but i also want to know how you can loop within a loop. never done that before... I think this is not too far off either...
What I'm trying to do:
http://www.selectguestlist.com/guest...?=feneo&club=1
Last edited by dihan; 06-27-04 at 06:05 PM.
|

06-28-04, 02:42 AM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
I think that you don't need this part:
unless there is another use of it in the rest of script..
all you need is $num_weeks..
you need before the for() loop something like that:
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

06-28-04, 08:27 AM
|
|
Coding Addict
|
|
Join Date: Jan 2004
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
strangly it did not return anything. Have I done the "for" bit correct? Is that how you can do a loop within a loop?
|

06-28-04, 09:55 AM
|
|
New Member
|
|
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In response to NeverMind:
You dont have to declare days[] over and over like that.
You can just simply do the following:
Not required, but just some advice to speed things up just a bit.
|

06-28-04, 12:50 PM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
Quote:
|
Originally Posted by Rylas
In response to NeverMind:
You dont have to declare days[] over and over like that.
You can just simply do the following:
Not required, but just some advice to speed things up just a bit.
|
yes I know ,,
but I prefer the first method for its clearity!
as for dihan, could you put the code after you changed it ?
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

06-29-04, 07:22 AM
|
|
Coding Addict
|
|
Join Date: Jan 2004
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sure de do da... :-) I know I pasted allot of it but I wated to show how I get months up... Which will determin which 4 days of the month that it should show. - [$night['iddays'] will show what day to look for and name="month" will give a number 1-12 of what month to look for and will populate name="select" with selected days of that month. (This is my main problem)
http://www.selectguestlist.com/guest...eo[DELETE]
Hope that makes sence.
PS This new forum template is looking slick...
Last edited by dihan; 06-29-04 at 07:44 AM.
|

06-29-04, 07:42 AM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
why did you remove $num_weeks ?
change the for() to:
note the equal sign in the second argument of for()!
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|