php-general Digest 29 Mar 2006 14:35:48 -0000 Issue 4041

Topics (messages 232794 through 232821):

Re: Not sure if this is a php problem or a mysql problem
        232794 by: Chris

Re: Script to sanitize variables
        232795 by: Chris

Re: private $foo
        232796 by: Jasper Bryant-Greene
        232803 by: Jochem Maas
        232816 by: tedd
        232819 by: Philip Thompson
        232820 by: tedd
        232821 by: Gerry Danen

Re: Div-element at same vert. position?
        232797 by: Jochem Maas

Problem with IE and not displaying the correct images...
        232798 by: Gregory Machin
        232801 by: Jochem Maas
        232807 by: Gregory Machin
        232808 by: Barry

require_once hell
        232799 by: Adrian Bruce
        232800 by: Thomas Munz
        232802 by: gustav.varupiraten.se

Re: Problem with IE and not displaying the correct images...]
        232804 by: Jochem Maas
        232806 by: gustav.varupiraten.se
        232817 by: Jochem Maas

Re: page expire error
        232805 by: Jochem Maas

Date addition problem
        232809 by: Adrian Bruce
        232810 by: Thomas Munz
        232811 by: Adrian Bruce
        232813 by: Adrian Bruce
        232815 by: Ford, Mike

Word to txt
        232812 by: Ministério Público

Re: php error reporting problem
        232814 by: ngwarai zed
        232818 by: Ford, Mike

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Paul Goepfert wrote:
Hi all,

I have developed a php functilon that is to return the date +1 from a
Mysql database.  My sql statement is as follows

SELECT dayNum FROM Days Where dayNum >= day(curdate())+1;

The function works great on the intended webserver but when placed on
a different mysql server (The one I have using to develop the webpage)
the return variable with the intended SQL statement is not being set.

What do you get on both servers when you run it manually through phpmyadmin or some other tool?

Are they the same mysql version - select version(); ?

Same php version?

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
On 3/29/06, Ray Hauge <[EMAIL PROTECTED]> wrote:

Chris Shiflett has written a number of good articles on the matter. You can
find them at:

http://shiflett.org/articles

The articles in particular would be:

Security Corner: Cross-Site Request Forgeries
Security Corner: Data Filtering
Security Corner: SQL Injection


Hello Ray,

Thanks for the links, they are very informative and gives a clear
background on this particular aspect of web security. I was looking
for an existing script that I can just plug in to my project though.

After some googling around, I've come across kses
(http://sourceforge.net/projects/kses). From the website, it says that
it's being used in Wordpress and Geeklog. There's also a PHP5 version
included in the release so for OOP purists, that ought to be great
news.

Could check out http://pecl.php.net/package/filter if you have enough access to the server.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Anthony Ettinger wrote:

private $foo; cannot be accessed directly outside the script.

print $f->foo; #fails

Fatal error: Cannot access private property Foo::$foo in
/x/home/username/docs/misc/php/client.php on line 11

Did you define the __get and __set functions in your class as in the previous post? Are you running a version of PHP that supports them?

Jasper

--- End Message ---
--- Begin Message ---
Anthony, Tedd,

you now grok the property overloading functionality of php5?
also the bug mentioned by M.Sokolewicz should be fixed in the latest
versions (can't remember exactly which one)

----------

Foo, Bar & Qux are used all over the place in IT in the same way
'Person A' and 'Person B' might be used when talking about marketing
demographics theory.

they are shortcuts to avoid having to think up realworld examples,
why would we want to do that?

1. real world examples are full of edge cases
2. real world examples are usually complicate the underlying theory
3. real world examples often sidetrack the 'learnee's attention away from the
core issue.
4. good real world examples are difficult to come up with
5. we are programmers, shortcuts is a way of life :-)

with regard to 'Christian Wenz' comment about imagination, try this
(imagination and creativity are bedfellows):

http://www.well.com/~jct/ugbio/ugbconv.htm

tedd wrote:
I am always using 'foo' in conversation and finally said it enough that
the CEO used it in a meeting the other day. Setter functions are cool.


That's interesting -- not meaning any disrespect, and this is just an opinion -- but in the newly published "PHP Phrasebook" by Christian Wenz (an excellent book btw), he says:

"Another phrase I promise you will not find in this book is anything that looks like foo, bar, baz, or any other proofs of very little imagination."

While you may not agree with his statement, but I personally don't like the use of terms like those for I find them confusing. I would much rather like to see real world examples. From there I can make the translation to what I want. But using terms like $foo just adds another level of abstraction for me understand. But, I'm also simple.

<only-read-this-if-you-have-seen-the-malibu-commercial>
not to worry - growing up generally entails becoming a 'complicated
little man'  ;-)
</only-read-this-if-you-have-seen-the-malibu-commercial>



tedd

--- End Message ---
--- Begin Message ---
Jochem:

Foo, Bar & Qux are used all over the place in IT in the same way
'Person A' and 'Person B' might be used when talking about marketing
demographics theory.

they are shortcuts to avoid having to think up realworld examples,
why would we want to do that?

1. real world examples are full of edge cases
2. real world examples are usually complicate the underlying theory
3. real world examples often sidetrack the 'learnee's attention away from the
core issue.
4. good real world examples are difficult to come up with
5. we are programmers, shortcuts is a way of life :-)

I'm not saying that foo is not used all over the place in IT. I'm simply saying, the practice of using foo adds another level of abstraction for me -- apparently your mileage varies.

Why would you want to do that? You don't have to, nor do you have to want to -- it's just a simpler way to convey information in teaching.

To respond to your points:

First, the edge case for foo IS abstraction. After all, foo is an abstraction, right?

Second, real world examples simplify the underlying theory. That's probably why grade school teachers use "Apples" instead of "foo" when teaching math.

Third, real world examples provide "familiar substance" and an easy "frame of reference" for students trying to learn the underlying core issue. Remember, the core issue should be the topic of focus, not "What's a foo?".

Fourth, good real world example are difficult to come up with, but they are worth it -- IF - you're trying to teach.

Fifth, shortcuts are a way of life AFTER you learn the way. You don't provide back-road directions for someone who's never been there before.

I've had conversations like this with Math professors. The only good argument I've heard for abstraction instead of providing real world examples was when it was not possible to find a real world example. There are many topics in theoretical math where real world examples don't exist. But, in programming, I can't think of a single one -- unless you're programming theoretical math. Everything we do is to solve a real world problem, is it not?

with regard to 'Christian Wenz' comment about imagination, try this
(imagination and creativity are bedfellows):

http://www.well.com/~jct/ugbio/ugbconv.htm

It was a long read, but if Krishnamurti had obtained his MS in Science instead of Philosophy perhaps his perspective would have been different, or at least rooted in science.

IMO , much of what he has to say is utter nonsense. It's a form of double-speak that's objecting to the status quo by providing an eastern-like "one-hand clapping" philosophy as a no-substance alternative. For example, he says:

"All the questions are born out of the answers. But nobody wants the answers. The end of the question is the end of the answer. The end of the solution is the end of the problem. We are only dealing with solutions and not with the problems."

That's just circular nonsense -- it contains no real value. It leaves the mind ranging for substance. It's like looking at a plot of random points and the mind, trained to derive order by differentiation, see's linear patterns where none are supported by the data.

<only-read-this-if-you-have-seen-the-malibu-commercial>
not to worry - growing up generally entails becoming a 'complicated
little man'  ;-)
</only-read-this-if-you-have-seen-the-malibu-commercial>

That makes more sense that the previous article. Besides, I can relate far too well - non sum qualis eram.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
On Mar 28, 2006, at 4:29 PM, Jay Blanchard wrote:

[snip]
That's interesting -- not meaning any disrespect, and this is just an
opinion -- but in the newly published "PHP Phrasebook" by Christian
Wenz (an excellent book btw), he says:

"Another phrase I promise you will not find in this book is anything
that looks like foo, bar, baz, or any other proofs of very little
imagination."

While you may not agree with his statement, but I personally don't
like the use of terms like those for I find them confusing. I would
much rather like to see real world examples. From there I can make
the translation to what I want. But using terms like $foo just adds
another level of abstraction for me understand. But, I'm also simple.
[/snip]

I have been programming since the mid 70's and foo was in the lexcon at
that point. I guess I am old school.


People have been programming since the 70's?!!?!! I didn't think it was possible until the early 90's! Wow I must be young! ;)

~Philip

--- End Message ---
--- Begin Message ---
I have been programming since the mid 70's and foo was in the lexcon at
that point. I guess I am old school.


People have been programming since the 70's?!!?!! I didn't think it was possible until the early 90's! Wow I must be young! ;)

~Philip

~Philip:

Read up on the history of computers -- the first programmer, as I recall, was one Lady Lovelace who programmed Babbage's first mechanical computer (if you don't count the abacus) in the early 1800's.

Of course, I remember programming with rocks and that was before we had zero's. We only had one's and that was a programming nightmare. You new guys at least have 1's and 0's to work with.

Best,

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
On 3/29/06, Philip Thompson <[EMAIL PROTECTED]> wrote:

> People have been programming since the 70's?!!?!! I didn't think it
> was possible until the early 90's! Wow I must be young! ;)

What do you mean '70's?  LOL

How about Grace Murray Hopper?

http://www.jamesshuggins.com/h/tek1/grace_hopper.htm

And here we are in the 1940's: http://www.computer50.org/

--- End Message ---
--- Begin Message ---
can someone nuke this guys addr form the list? pretty please?

[EMAIL PROTECTED] wrote:
Please use [EMAIL PROTECTED] instead of [EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
Hi
I have a site that changes the backround pic after login both have different
names..
it work perfect in firefox and epiphany , but not IE , it loads the login
page with the
backround that's only suposed to be displayed  after login ..
If I download the 2 picks manual they both work fine ...
Both pics have different name ..
I'm lost any ideas ..

Thanks for your time..

--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096

--- End Message ---
--- Begin Message ---
Gregory Machin wrote:
Hi
I have a site that changes the backround pic after login both have different
names..
it work perfect in firefox and epiphany , but not IE , it loads the login
page with the
backround that's only suposed to be displayed  after login ..
If I download the 2 picks manual they both work fine ...
Both pics have different name ..
I'm lost any ideas ..

use 2 stylesheets. and switch between them?

(doesn't sound much like a php question btw ;-)



Thanks for your time..

--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096

--- End Message ---
--- Begin Message ---
Problem found ...
IE doesn't understand comments '//' in style sheets ..
so the line I had commented out refering to the background image in the
style sheet was over riding my code later in the page..

On 3/29/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> Gregory Machin wrote:
> > Hi
> > I have a site that changes the backround pic after login both have
> different
> > names..
> > it work perfect in firefox and epiphany , but not IE , it loads the
> login
> > page with the
> > backround that's only suposed to be displayed  after login ..
> > If I download the 2 picks manual they both work fine ...
> > Both pics have different name ..
> > I'm lost any ideas ..
>
> use 2 stylesheets. and switch between them?
>
> (doesn't sound much like a php question btw ;-)
>
>
> >
> > Thanks for your time..
> >
> > --
> > Gregory Machin
> > [EMAIL PROTECTED]
> > [EMAIL PROTECTED]
> > www.linuxpro.co.za
> > www.exponent.co.za
> > Web Hosting Solutions
> > Scalable Linux Solutions
> > www.iberry.info (support and admin)
> >
> > +27 72 524 8096
>
>


--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096

--- End Message ---
--- Begin Message ---
Gregory Machin wrote:
Problem found ...
IE doesn't understand comments '//' in style sheets ..
so the line I had commented out refering to the background image in the
style sheet was over riding my code later in the page..

Not quite right.
Only // doesn't work

But /* COMMENT */ does

greets

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--- End Message ---
--- Begin Message ---
Hi

this may be a stupid moment but i cant find an help on google so.....i am including two classes in my code using the "require_once("path to file")" method. this works fine for the first class but when including the second it simply outputs the contents on to the page. I feel I must be missing something stupid so i have not included any example code, any general ideas?

Thanks in advance

Ade

--- End Message ---
--- Begin Message ---
Forgot the <?php tag in the second class?


on Wednesday 29 March 2006 12:48, Adrian Bruce wrote:
> Hi
>
> this may be a stupid moment but i cant find an help on google so.....i
> am including two classes in my code using the  "require_once("path to
> file")" method.  this works fine for the first class but when including
> the second it simply outputs the contents on to the page.  I feel I must
> be missing something stupid so i have not included any example code, any
> general ideas?
>
> Thanks in advance
>
> Ade

--- End Message ---
--- Begin Message ---
> Hi
>
> this may be a stupid moment but i cant find an help on google so.....i
> am including two classes in my code using the  "require_once("path to
> file")" method.  this works fine for the first class but when including
> the second it simply outputs the contents on to the page.  I feel I must
> be missing something stupid so i have not included any example code, any
> general ideas?
>
> Thanks in advance
>
> Ade
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi!

It would be easier if you would include some code...

/Gustav Wiberg

--- End Message ---
--- Begin Message ---
if anyone feels like DDoS'ing ksa.zajil.com ...

be my guest :-/

-------- Original Message --------
Return-Path: <[EMAIL PROTECTED]>

Received: from localhost (localhost [127.0.0.1])        by mx1.moulin.nl 
(Postfix) with ESMTP id 392B7172C08    for

Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) 
(amavisd-new, port 10024) with ESMTP id

Received: from zlinuxweb.zajil.net (zlinuxweb.zajil.net [212.24.224.144])       
by mx1.moulin.nl (Postfix) with ESMTP id

Received: (qmail 414 invoked by uid 0); 29 Mar 2006 14:03:34 +0300
Date: 29 Mar 2006 14:03:34 +0300
Message-ID: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]

Cc:
Subject: Re: Re: [PHP] Problem with IE and not displaying the correct images...
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
X-Virus-Scanned: amavisd-new at moulin.nl

Please use [EMAIL PROTECTED] instead of [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> if anyone feels like DDoS'ing ksa.zajil.com ...
>
> be my guest :-/
>
*LOL*

> -------- Original Message --------
> Return-Path: <[EMAIL PROTECTED]>
>
> Received: from localhost (localhost [127.0.0.1])      by mx1.moulin.nl
> (Postfix) with ESMTP id 392B7172C08   for
>
> Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin
> [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id
>
> Received: from zlinuxweb.zajil.net (zlinuxweb.zajil.net
> [212.24.224.144])     by mx1.moulin.nl (Postfix) with ESMTP id
>
> Received: (qmail 414 invoked by uid 0); 29 Mar 2006 14:03:34 +0300
> Date: 29 Mar 2006 14:03:34 +0300
> Message-ID: <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
>
> Cc:
> Subject: Re: Re: [PHP] Problem with IE and not displaying the correct
> images...
> Content-Type: text/plain; charset="UTF-8"
> Content-Transfer-Encoding: 8bit
> Content-Disposition: inline
> X-Virus-Scanned: amavisd-new at moulin.nl
>
> Please use [EMAIL PROTECTED] instead of [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
John Ellingsworth wrote:
I must be missing something - why?  j/w . . .x

you should have recieved a nice email from Nayeem
by now.

as to the real reason why your missing something ...
I don't know. maybe someone cut the something off? ;-)


Jochem Maas wrote:

if anyone feels like DDoS'ing ksa.zajil.com ...

be my guest :-/

-------- Original Message --------
Return-Path: <[EMAIL PROTECTED]>

Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 392B7172C08 for

Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id

Received: from zlinuxweb.zajil.net (zlinuxweb.zajil.net [212.24.224.144]) by mx1.moulin.nl (Postfix) with ESMTP id

Received: (qmail 414 invoked by uid 0); 29 Mar 2006 14:03:34 +0300
Date: 29 Mar 2006 14:03:34 +0300
Message-ID: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]

Cc:
Subject: Re: Re: [PHP] Problem with IE and not displaying the correct images...
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
X-Virus-Scanned: amavisd-new at moulin.nl

Please use [EMAIL PROTECTED] instead of [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
you forgot to ask a question? (again)

suresh kumar wrote:
Hai,
    i am facing one problem in my project.I am using 2
pages for search operation.

   In Search page 1:
                    i am having 3 fields say Company
name,state,country. when user enters search key in
their corresponding field and press submit button.
search result will be displayed in  another page
"Search result page".when i click back button in
browser toolbar.it is displaying error message as

"The page you requested was created using information
you submitted in a form. This page is no longer
available. As a security precaution, Internet Explorer
does not automatically resubmit your information for
you" .

     I am storing the field name in session.


                
__________________________________________________________ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com


--- End Message ---
--- Begin Message ---
Hi

I am having an unusual problem when trying to calculate dates in advance from a start date. the code below shows a loop where by on each run an increasing number of weeks is added to the start date, this works as expected up untill the 8th time where for some reason it produces 01-11-05 instead of 02-11-05. I am at a loss as to why this would happen when it works perfectly for all the other dates. where am i going wrong?

[snip]

<?php
echo"<h1> date test</h1>";
$start = "05-09-07";
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i<10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echo"<h1>$i:  $startdate -- -- --$nextdate</h1>";
}
?>
OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade

--- End Message ---
--- Begin Message ---
Cause 9th month have 30 days but 10th month have 31 days. You don't check the 
amount of day there... :)


on Wednesday 29 March 2006 14:51, Adrian Bruce wrote:
> Hi
>
> I am having an unusual problem when trying to calculate dates in advance
> from a start date.  the code below shows a loop where by on each run an
> increasing number of weeks is added to the start date, this works as
> expected up untill the 8th time where for some reason it produces
> 01-11-05 instead of 02-11-05.  I am at a loss as to why this would
> happen when it works perfectly for all the other dates.  where am i
> going wrong?
>
> [snip]
>
> <?php
> echo"<h1> date test</h1>";
> $start = "05-09-07";
> $start = explode('-',$start);
> $startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
> $startdate = date('d-m-y',$startmk);
>
> for($i=0;$i<10;$i++){
>     $nextdate = date('d-m-y',$startmk + ($i*604800));
>     echo"<h1>$i:  $startdate -- -- --$nextdate</h1>";
> }
> ?>
>
> OUTPUT:
>
> 0: 07-09-05 -- -- --07-09-05
> 1: 07-09-05 -- -- --14-09-05
> 2: 07-09-05 -- -- --21-09-05
> 3: 07-09-05 -- -- --28-09-05
> 4: 07-09-05 -- -- --05-10-05
> 5: 07-09-05 -- -- --12-10-05
> 6: 07-09-05 -- -- --19-10-05
> 7: 07-09-05 -- -- --26-10-05
> 8: 07-09-05 -- -- --01-11-05
> 9: 07-09-05 -- -- --08-11-05
>
> [/snip]
>
> Thanks a lot
>
> Ade

--- End Message ---
--- Begin Message --- That should not effect it, if i am adding $i * 7 days each time then i should get the date that comes 7 days later irrespective of how many days are in the month, shouldn't I ? 8 * 7 = 56, 56 days after the 07-09-05 is 02-11-2005.

Thomas Munz wrote:

Cause 9th month have 30 days but 10th month have 31 days. You don't check the amount of day there... :)


on Wednesday 29 March 2006 14:51, Adrian Bruce wrote:
Hi

I am having an unusual problem when trying to calculate dates in advance
from a start date.  the code below shows a loop where by on each run an
increasing number of weeks is added to the start date, this works as
expected up untill the 8th time where for some reason it produces
01-11-05 instead of 02-11-05.  I am at a loss as to why this would
happen when it works perfectly for all the other dates.  where am i
going wrong?

[snip]

<?php
echo"<h1> date test</h1>";
$start = "05-09-07";
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i<10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echo"<h1>$i:  $startdate -- -- --$nextdate</h1>";
}
?>

OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade


--- End Message ---
--- Begin Message ---

I have come up with an alternative myself but still cant explain why the first method did not work, still be interested to know why if anyone can offer some thoughts. Using strtotime for the calc seems to produce correct results

my soluiton:
[snip]

<?php
echo"<h1> date test 2</h1>";
$start = "05-09-07";
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('Y-m-d',$startmk);

for($i=0;$i<10;$i++){
$add = $i*7; $nextdate = date('d-m-y', strtotime($startdate." + ".$add." days")); echo"<h1>$i: $startdate -- -- --$nextdate</h1>";
}
?>
[/snip]

Adrian Bruce wrote:

That should not effect it, if i am adding $i * 7 days each time then i should get the date that comes 7 days later irrespective of how many days are in the month, shouldn't I ? 8 * 7 = 56, 56 days after the 07-09-05 is 02-11-2005.

Thomas Munz wrote:

Cause 9th month have 30 days but 10th month have 31 days. You don't check the amount of day there... :)


on Wednesday 29 March 2006 14:51, Adrian Bruce wrote:
Hi

I am having an unusual problem when trying to calculate dates in advance
from a start date.  the code below shows a loop where by on each run an
increasing number of weeks is added to the start date, this works as
expected up untill the 8th time where for some reason it produces
01-11-05 instead of 02-11-05.  I am at a loss as to why this would
happen when it works perfectly for all the other dates.  where am i
going wrong?

[snip]

<?php
echo"<h1> date test</h1>";
$start = "05-09-07";
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i<10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echo"<h1>$i:  $startdate -- -- --$nextdate</h1>";
}
?>

OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade




--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Adrian Bruce [mailto:[EMAIL PROTECTED] 
> Sent: 29 March 2006 13:52
> 
> I am having an unusual problem when trying to calculate dates 
> in advance 
> from a start date.  the code below shows a loop where by on 
> each run an 
> increasing number of weeks is added to the start date, this works as 
> expected up untill the 8th time where for some reason it produces 
> 01-11-05 instead of 02-11-05.  I am at a loss as to why this would 
> happen when it works perfectly for all the other dates.  where am i 
> going wrong?
> 
> [snip]
> 
> <?php
> echo"<h1> date test</h1>";
> $start = "05-09-07";
> $start = explode('-',$start);
> $startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
> $startdate = date('d-m-y',$startmk);
> 
> for($i=0;$i<10;$i++){
>     $nextdate = date('d-m-y',$startmk + ($i*604800));
>     echo"<h1>$i:  $startdate -- -- --$nextdate</h1>";
> }
> ?>   

You're not allowing for DST shifts. 02-11-05 is after the clocks go back
an hour, so instead of getting 00:00 on 02-11-05 you're getting 11:00 on
01-11-05.

I always suggest working with the *other* 12 o'clock when calculating
purely date offsets -- 12:00 may still shift to 11:00 or 13:00, but this
will not affect the date!
Cheers!

Mike
 
------------------------------------------------------------------------
----------------
Mike Ford, Electronic Information Services Adviser, Learning Support
Services,
JG125, The Library, James Graham Building, Headingley Campus, Beckett
Park,
LEEDS, LS6 3QS,     United Kingdom
Tel: +44 113 283 2600 extn 4730    Fax: +44 113 283 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message ---
I'd like to know if any of you know if I can and if I can how do I do to
transform a Word documento to txt with php.

What I'd like to do is offer the user in my site to upload a word file and
the script transforms the word to txt and saves to server, my site already
can receive txt.
Thanx to you all.

Rodrigo

--- End Message ---
--- Begin Message ---
I checked the apache error log and the error is written there just as I
expected like below.

[client 127.0.0.1] PHP Parse error:  parse error, unexpected T_STRING,
expecting ',' or ';'   on line 90, referer: http://localhost/form.html

The problem is I know what the error is. What I want is for the error to be
shown when I run the script not to be just written to the error log. I tried
changing display_errors = On and error_reporting = On in php.ini , restarted
httpd but when I check with phpinfo() I still see display_errors set to Off
and error_reporting set to 2047. My php script still does not show any
errors. Why are my changes to php.ini not refrlected when I run phpinfo() ?
Where am I getting it all wrong?

Display_error and errror_reporting were a typo. I wrote these correctly
while editing php.ini. I mean I wrote display_errors and error_reporting.

Thanks in advance

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: ngwarai zed [mailto:[EMAIL PROTECTED] 
> Sent: 29 March 2006 14:39
> To: Christopher Murtagh

> The problem is I know what the error is. What I want is for 
> the error to be shown when I run the script not to be just 
> written to the error log. I tried changing display_errors = 
> On and error_reporting = On in php.ini , restarted httpd but 
> when I check with phpinfo() I still see display_errors set to 
> Off and error_reporting set to 2047. My php script still does 
> not show any errors. Why are my changes to php.ini not 
> refrlected when I run phpinfo() ? Where am I getting it all wrong?

You're not editing the right php.ini -- check phpinfo() for where it
says it's expecting php.ini to be (right near the top), and go edit that
instead.

Cheers!

Mike
 
------------------------------------------------------------------------
----------------
Mike Ford, Electronic Information Services Adviser, Learning Support
Services,
JG125, The Library, James Graham Building, Headingley Campus, Beckett
Park,
LEEDS, LS6 3QS,     United Kingdom
Tel: +44 113 283 2600 extn 4730    Fax: +44 113 283 3211
 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---

Reply via email to