php-windows Digest 10 Jun 2004 19:11:14 -0000 Issue 2279

Topics (messages 23948 through 23953):

Problem No of weeks returned by date function
        23948 by: Sukhwinder Singh
        23949 by: Svensson, B.A.T. (HKG)

R: [PHP-WIN] Problem No of weeks returned by date function
        23950 by: Francesco.Marsan.bmg.com

output html reports to printer and not browser
        23951 by: Brent
        23952 by: Alejandro C�sar Garrammone

Opening Search results in a New Window
        23953 by: Raj Gopal

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hello,
 I want to display a report per week.

 I am facing a problem with php date function.

 date() function returns week 1 for a date in last year.

 <?php
  $ts = mktime(0, 0, 0, 12, 29, 2003);
  echo date("W", $ts);

 // returns 1. Is this a bug
 ?>


 But mysql week function returns 53.

 select week('2003-12-29', 1)

 I am losing the data for week 53 because I have to display week using php
and then hits for that week using mysql records.

 I am using PHP Version 4.3.6 on Windows 2000.

 Is this a php bug where it is assumed that there can be just 52 weeks in a
year? If yes then how mysql displays week from 0 to 53?

--Sukhwinder Singh

--- End Message ---
--- Begin Message ---
I guess both function just have different interpretation (and none of them
are incorrect), the best thing you can do is to translate any occurence of
week 53 to week 1, that should solve your problem of losing data in the
start-end case.

An alternative solution is to explain for the customer how it works (that
end cases always are tricky and casues problem), and tell them that
"missing" data from week 1 can be found in week 53. And if they complain,
then explain that "this is a complicated tech matter, but of course if you
put $$.$$$:- on the table I can always fix it".


-----Original Message-----
From: Sukhwinder Singh
To: [EMAIL PROTECTED]
Sent: 10-6-2004 20:59
Subject: [PHP-WIN] Problem No of weeks returned by date function

Hello,
 I want to display a report per week.

 I am facing a problem with php date function.

 date() function returns week 1 for a date in last year.

 <?php
  $ts = mktime(0, 0, 0, 12, 29, 2003);
  echo date("W", $ts);

 // returns 1. Is this a bug
 ?>


 But mysql week function returns 53.

 select week('2003-12-29', 1)

 I am losing the data for week 53 because I have to display week using
php
and then hits for that week using mysql records.

 I am using PHP Version 4.3.6 on Windows 2000.

 Is this a php bug where it is assumed that there can be just 52 weeks
in a
year? If yes then how mysql displays week from 0 to 53?

--Sukhwinder Singh

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
There are 2 different ways to calculate the week number: the date() function
only provides for one. The other one (called "ISO") can be calculated using
this function, taken from the online notes to the PHP manual (so always back
to RTM):

function ISOWeek($y, $m, $d) 
{ 
$week=strftime("%W", mktime(0, 0, 0, $m, $d, $y)); 
$dow0101=getdate(mktime(0, 0, 0, 1, 1, $y)); 
$next0101=getdate(mktime(0, 0, 0, 1, 1, $y+1)); 

 if ($dow0101["wday"]>1 && 
   $dow0101["wday"]<5) 
   $week++; 
 if ($next0101["wday"]>1 && 
   $next0101["wday"]<5 && 
     $week==53) 
   $week=1; 
 if ($week==0) 
   $week = ISOWeek($y-1,12,31); 

 // return(substr("00" . $week, -2)); 
 return($week);
} 


HTH
Francesco
-----Messaggio originale-----
Da: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED] 
Inviato: gioved� 10 giugno 2004 10.29
A: 'Sukhwinder Singh '; '[EMAIL PROTECTED] '
Oggetto: RE: [PHP-WIN] Problem No of weeks returned by date function

I guess both function just have different interpretation (and none of them
are incorrect), the best thing you can do is to translate any occurence of
week 53 to week 1, that should solve your problem of losing data in the
start-end case.

An alternative solution is to explain for the customer how it works (that
end cases always are tricky and casues problem), and tell them that
"missing" data from week 1 can be found in week 53. And if they complain,
then explain that "this is a complicated tech matter, but of course if you
put $$.$$$:- on the table I can always fix it".


-----Original Message-----
From: Sukhwinder Singh
To: [EMAIL PROTECTED]
Sent: 10-6-2004 20:59
Subject: [PHP-WIN] Problem No of weeks returned by date function

Hello,
 I want to display a report per week.

 I am facing a problem with php date function.

 date() function returns week 1 for a date in last year.

 <?php
  $ts = mktime(0, 0, 0, 12, 29, 2003);
  echo date("W", $ts);

 // returns 1. Is this a bug
 ?>


 But mysql week function returns 53.

 select week('2003-12-29', 1)

 I am losing the data for week 53 because I have to display week using php
and then hits for that week using mysql records.

 I am using PHP Version 4.3.6 on Windows 2000.

 Is this a php bug where it is assumed that there can be just 52 weeks in a
year? If yes then how mysql displays week from 0 to 53?

--Sukhwinder Singh

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Howdy,
Are there any php commands or otherwsie to send a report made in html to a
selected printer locally
and not go to the browse screen if a link was selected????
Brent.

--- End Message ---
--- Begin Message ---
I think if you look in the manual, it says something about this on the
appendix. Then you must configure the printer on the php.ini (look at the
bottom of it)

Hope this helps,

Alex
----- Original Message -----
From: "Brent" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 10, 2004 11:27 AM
Subject: [PHP-WIN] output html reports to printer and not browser


> Howdy,
> Are there any php commands or otherwsie to send a report made in html to a
> selected printer locally
> and not go to the browse screen if a link was selected????
> Brent.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi All,
   I have a Form with a Search button and when the user types the
Search word and clicks on Search, I would like to open a New Window and
present the search results.I have already developed a PHP function using
Oracle oci8.dll and tested it. It takes a search criteria as Input,
connects to the Oracle database, makes the query and presents a table of
results. How do I call the function via a PHP script from the Search
button with the user entered text? 
Appreciate Ur Help!!

--- End Message ---

Reply via email to