Is there any substitute for header function?
| From: | Balaji Ankem | Date: | Wed, 29 May 2002 05:49:08 +0000 |
| Subject: | Is there any substitute for header function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99631@lists.php.net to get a copy of this message | ||
Hi,
Is there any substitute for header function..
Because of this I am getting error saying.."php.exe has generated some
errors and will be closed by windows".
if ($row->user_type=='A')
{
mysql_close($connection);
header("Location:admin.php");
exit;
}
Thanks in advance
Balaji
-----Original Message-----
From: Martin Towell [mailto:martin.towell@world.net]
Sent: Wednesday, May 29, 2002 10:32 AM
To: 'Ed Lazor'
Cc: php-general@lists.php.net
Subject: RE: [PHP] easy date question?
If you want to make it a few line shorter, change
if ($MonthStartDay < $Day)
{
$C = $Day - $MonthStartDay;
}
else if ($MonthStartDay > $Day)
{
$C = 7 - $MonthStartDay + $Day;
}
to
$C = ($MonthStartDay > $Day ? 7 : 0) + $Day - $MonthStartDay;
or maybe
$C = ($MonthStartDay < $Day ? 0 : 7) + $Day - $MonthStartDay;
I haven't tried either one, so it may break it...
If one, or both, work, then you could combine this line with the
"return" line
-----Original Message-----
From: Ed Lazor [mailto:osmosis@atfantasy.com]
Sent: Wednesday, May 29, 2002 2:44 PM
To: Rasmus Lerdorf
Cc: php-general@lists.php.net
Subject: Re: [PHP] easy date question?
I came up with a solution that I'd like to share. Could someone confirm
whether it's the best approach?
Thanks,
-Ed
--------- source code ----------------
# ex.: GetDay ("Third", "Saturday", 5, 2002);
function GetDay($Week, $Day, $Month, $Year)
{
$MonthStartDay = date("w", mktime(0,0,0,$Month,1,$Year) ) + 1;
switch ($Week)
{
case "First" : $Week = 0; break;
case "Second" : $Week = 7; break;
case "Third" : $Week = 14; break;
case "Fourth" : $Week = 21; break;
}
switch ($Day)
{
case "Sunday" : $Day = 1; break;
case "Monday" : $Day = 2; break;
case "Tuesday" : $Day = 3; break;
case "Wednesday" : $Day = 4; break;
case "Thursday" : $Day = 5; break;
case "Friday" : $Day = 6; break;
case "Saturday" : $Day = 7; break;
}
$C = 0;
if ($MonthStartDay < $Day)
{
$C = $Day - $MonthStartDay;
}
else if ($MonthStartDay > $Day)
{
$C = 7 - $MonthStartDay + $Day;
}
return ($C + 1 + $Week);
}
--------------------------------
At 05:55 PM 5/28/2002 -0700, Rasmus Lerdorf wrote:
>See the PEAR Date/Calc class.
>
>On Tue, 28 May 2002, Ed Lazor wrote:
>
> > How can I find out the date of the 3rd Tuesday of any given month?
> >
> > Thanks,
> >
> > -Ed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
**************************Disclaimer************************************************** Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ****************************************************************************************
**************************Disclaimer************************************************** Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ****************************************************************************************