php-general Digest 7 Feb 2006 16:33:20 -0000 Issue 3950

Topics (messages 230024 through 230048):

Re: Is this the most effient to do with php an mysql?
        230024 by: Ligaya Turmelle
        230026 by: Peter Lauri
        230027 by: Oliver Grätz
        230028 by: Peter Lauri

Re: Making Php Libraries
        230025 by: Oliver Grätz
        230030 by: Christopher Taylor

Re: Window close.
        230029 by: Oliver Grätz
        230033 by: Labunski
        230035 by: Barry
        230041 by: Miles Thompson

setting Headers using htmlMimeMail class?
        230031 by: Angelo Zanetti
        230032 by: Angelo Zanetti
        230043 by: Richard Heyes
        230044 by: Angelo Zanetti

Re: APD generates no output
        230034 by: Jochem Maas
        230042 by: Gustavo Narea

How to user curl_setopt?
        230036 by: lhb
        230038 by: James Benson

Re: mail problem
        230037 by: Angelo Zanetti

Re: Get recursive array
        230039 by: Jochem Maas

Re: Recompile PHP on pre-installed system
        230040 by: Jochem Maas
        230047 by: Marcus Bointon

The Big Date and Time Debacle
        230045 by: Stephen Martindale
        230046 by: Christopher Taylor
        230048 by: Dan Baker

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 ---
using mysql is better then using php.
SELECT y_id, year FROM Year WHERE year <=  year(curdate)
ORDER BY year desc;

Paul Goepfert wrote:
Hi all,

I have a table of years going from 1985 - 2008.  These years represent
the purchase year.  I have created a SQL statement that selects the
years that are available for purchase years. For example 2006 -1985. Here is the SQL statement I created to produce that output.


SELECT y_id, year FROM Year WHERE year <=  extract(year from now())
ORDER BY year desc;

Is there a more efficient way to do this using more PHP and less mysql?

Thanks

Paul


--

life is a game... so have fun.

--- End Message ---
--- Begin Message ---
Paul,

In your purchase table, do you have the exact date when the equipment was
purchased? If that is the case, then you do not need the additional year
table, your original table already consist of that information.

/Peter


-----Original Message-----
From: Paul Goepfert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 07, 2006 10:45 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Is this the most effient to do with php an mysql?

I am using this table to find out what year the person purchased their
equipment

On 2/6/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
> I do not know if it is more efficient, but you can do this:
>
> $year = date("Y");
> $Query = sprintf("SELECT y_id, year FROM Year WHERE year <= %s ORDER BY
year
> DESC;", $year);
> $Result = mysql_query($Query);
>
> May I ask you what you are using this table for?
>
> /Peter
>
> -----Original Message-----
> From: Paul Goepfert [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 07, 2006 7:55 AM
> To: php-general@lists.php.net
> Subject: [PHP] Is this the most effient to do with php an mysql?
>
> Hi all,
>
> I have a table of years going from 1985 - 2008.  These years represent
> the purchase year.  I have created a SQL statement that selects the
> years that are available for purchase years.  For example 2006 -1985.
> Here is the SQL statement I created to produce that output.
>
>
> SELECT y_id, year FROM Year WHERE year <=  extract(year from now())
> ORDER BY year desc;
>
> Is there a more efficient way to do this using more PHP and less mysql?
>
> Thanks
>
> Paul
>
> --
> 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

--- End Message ---
--- Begin Message ---
Paul Goepfert schrieb:
> Is there a more efficient way to do this using more PHP and less mysql?

Anything that helps you inside SQL to get your solution doing just one
statement should be faster than doing two queries with some PHP code
inbetween for "reasonable complicated" tasks. This is because the time
overheads for using the connection and the socket overhead are bigger
than the time won by doing the intermediate calculation "a bit" better
with PHP.

So, if your SQL looks somehow similar to what you would do on the PHP
side: Keep it that way!

OLLi

--- End Message ---
--- Begin Message ---
And mysql is probably the fastest way. BUT use microtime and clock your
scripts to find out witch one is faster.

-----Original Message-----
From: Paul Goepfert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 07, 2006 10:45 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Is this the most effient to do with php an mysql?

I am using this table to find out what year the person purchased their
equipment

On 2/6/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
> I do not know if it is more efficient, but you can do this:
>
> $year = date("Y");
> $Query = sprintf("SELECT y_id, year FROM Year WHERE year <= %s ORDER BY
year
> DESC;", $year);
> $Result = mysql_query($Query);
>
> May I ask you what you are using this table for?
>
> /Peter
>
> -----Original Message-----
> From: Paul Goepfert [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 07, 2006 7:55 AM
> To: php-general@lists.php.net
> Subject: [PHP] Is this the most effient to do with php an mysql?
>
> Hi all,
>
> I have a table of years going from 1985 - 2008.  These years represent
> the purchase year.  I have created a SQL statement that selects the
> years that are available for purchase years.  For example 2006 -1985.
> Here is the SQL statement I created to produce that output.
>
>
> SELECT y_id, year FROM Year WHERE year <=  extract(year from now())
> ORDER BY year desc;
>
> Is there a more efficient way to do this using more PHP and less mysql?
>
> Thanks
>
> Paul
>
> --
> 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

--- End Message ---
--- Begin Message ---
All attempts at shutting of access to the code is bound to fail. PHP is
an interpreted anguage. If the script on the other server can read your
code then the programmer of that script can also read your sourcecode.
So, what to do?

You could use some of the encoders. Using these tools the other people
can still read the code but they'll find it too ugly to invest the work
trying to understand it. But nothing keeps them from not even trying to
understand it but just stealing it and using it as is. Nothing won.

Then there's something from Zend that encodes your file so that it CAN'T
be read as source code. A normal server can't even execute it. Your
users will have to install some runtime module. The encoder isn't free,
the runtime is. This stuff even allows for expiring licenses if I recall
correctly. So you could give the code to your users and still you won't
loose control over it.

Finally: Why give users access to your code? Why don't you just let them
use it in a specified way? Donig so is called defining a PROTOCOL. give
your users exact specifications of what they may call and what they'll
get back. There are even big enterprise-oh-my-god-complicated solutions
for calling code remotely, with SOAP and the .NET web services being the
most prominent ones. There's SOAP support in PHP so you might want to
snoop at that.

OK, gotta sleep ;-)

OLLi

--- End Message ---
--- Begin Message ---
Oliver Grätz wrote:
All attempts at shutting of access to the code is bound to fail. PHP is
an interpreted anguage. If the script on the other server can read your
code then the programmer of that script can also read your sourcecode.
So, what to do?

You could use some of the encoders. Using these tools the other people
can still read the code but they'll find it too ugly to invest the work
trying to understand it. But nothing keeps them from not even trying to
understand it but just stealing it and using it as is. Nothing won.

Then there's something from Zend that encodes your file so that it CAN'T
be read as source code. A normal server can't even execute it. Your
users will have to install some runtime module. The encoder isn't free,
the runtime is. This stuff even allows for expiring licenses if I recall
correctly. So you could give the code to your users and still you won't
loose control over it.

Finally: Why give users access to your code? Why don't you just let them
use it in a specified way? Donig so is called defining a PROTOCOL. give
your users exact specifications of what they may call and what they'll
get back. There are even big enterprise-oh-my-god-complicated solutions
for calling code remotely, with SOAP and the .NET web services being the
most prominent ones. There's SOAP support in PHP so you might want to
snoop at that.

OK, gotta sleep ;-)

OLLi


Thanks for the help from everyone on the list. I have a lot to consider. I will look into some of the encoders and possibly some of the SOAP services. Another option I am working on is to keep the scripts and data on my server. There may end up being some bandwidth issues, but I will have to see. This could be another alternative. Time for more research. :)

Chris

--- End Message ---
--- Begin Message ---
Just for the laugh: You could send a redirection to a page that causes
the browser to crash ;-) No client side scripting involved *g*.

OLLi

--- End Message ---
--- Begin Message ---
It can'tbe done with PHP, cause it must be client side script, aka 
Javascript:

"javascript: window.close();" 

--- End Message ---
--- Begin Message ---
Oliver Grätz wrote:
Just for the laugh: You could send a redirection to a page that causes
the browser to crash ;-) No client side scripting involved *g*.

OLLi
Or fill up the buffer till browser crashes ^_^

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

--- End Message ---
--- Begin Message ---
At 03:42 AM 2/7/2006, Labunski wrote:

It can'tbe done with PHP, cause it must be client side script, aka
Javascript:

"javascript: window.close();"

--

Actually, expand it a little bit, and you avoid the JS Alert.

function close_opener(){
parentwin = window.self; // Make handle for current window named "parentwin" parentwin.opener = window.self; // Tell current window that it opened itself parentwin.close(); // Close window's parent (e.g. the current window)
}

Can't take credit for it, had a similar problem years ago when I had to pop a window up to establish a session and immediately destroy it. And that was because I could not set a session from within Flash, nor access a session from Flash.

Regards - Miles Thompson


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.15.2/252 - Release Date: 2/6/2006

--- End Message ---
--- Begin Message ---
hi guys.

I'm having a problem with mails I'm sending out using htmlMimeMail class. Some of the mail accounts mark the mails as trash/bulk/spam and on some accounts the mail doesnt come through at all. Im assuming it has something to do with the headers of the email.

In the htmlMimeMail class the setHeader function takes two arguments. Im not sure what the arguments are and I've also had little luck finding help or documentation about that function.

headers would be something like this:

  $headers="";
   $headers .= "X-Sender:  $mail <$mail>\n"; //
   $headers .="From: $mail_f <$mail_f>\n";
   $headers .= "Reply-To: $mail_f <$mail_f>\n";
   $headers .= "Date: ".date("r")."\n";
$headers .= "Message-ID: <".date("YmdHis")."you@".$_SERVER['SERVER_NAME'].">\n";
   $headers .= "Subject: $subject\n";
   $headers .= "Return-Path: $mail_f <$mail_f>\n";
   $headers .= "Delivered-to: $mail_f <$mail_f>\n";
   $headers .= "MIME-Version: 1.0\n";
   $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
   $headers .= "X-Priority: 1\n";
   $headers .= "Importance: High\n";
   $headers .= "X-MSMail-Priority: High\n";
   $headers .= "X-Mailer: A PHP mailer!\n";

but how do I incorporate that into the setHeader function?

thanks in advance

--

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

--- End Message ---
--- Begin Message ---
Ok I take it, it will be something like this:

 $mail = new htmlMimeMail();
$mail->setHeader("Return-Path", $proxy_from);
$mail->setHeader("Reply-To", $proxy_from);

??

i'll give it a try and let u know if I came right!


Angelo Zanetti wrote:
hi guys.

I'm having a problem with mails I'm sending out using htmlMimeMail class. Some of the mail accounts mark the mails as trash/bulk/spam and on some accounts the mail doesnt come through at all. Im assuming it has something to do with the headers of the email.

In the htmlMimeMail class the setHeader function takes two arguments. Im not sure what the arguments are and I've also had little luck finding help or documentation about that function.

headers would be something like this:

  $headers="";
   $headers .= "X-Sender:  $mail <$mail>\n"; //
   $headers .="From: $mail_f <$mail_f>\n";
   $headers .= "Reply-To: $mail_f <$mail_f>\n";
   $headers .= "Date: ".date("r")."\n";
$headers .= "Message-ID: <".date("YmdHis")."you@".$_SERVER['SERVER_NAME'].">\n";
   $headers .= "Subject: $subject\n";
   $headers .= "Return-Path: $mail_f <$mail_f>\n";
   $headers .= "Delivered-to: $mail_f <$mail_f>\n";
   $headers .= "MIME-Version: 1.0\n";
   $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
   $headers .= "X-Priority: 1\n";
   $headers .= "Importance: High\n";
   $headers .= "X-MSMail-Priority: High\n";
   $headers .= "X-Mailer: A PHP mailer!\n";

but how do I incorporate that into the setHeader function?

thanks in advance


--- End Message ---
--- Begin Message ---
Angelo Zanetti wrote:
Ok I take it, it will be something like this:

 $mail = new htmlMimeMail();
$mail->setHeader("Return-Path", $proxy_from);
$mail->setHeader("Reply-To", $proxy_from);

??

Correct.

--
Richard Heyes

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

Richard Heyes wrote:
Angelo Zanetti wrote:

Ok I take it, it will be something like this:

 $mail = new htmlMimeMail();
$mail->setHeader("Return-Path", $proxy_from);
$mail->setHeader("Reply-To", $proxy_from);

??


Correct.

yip it worked thanks!!

--- End Message ---
--- Begin Message ---
Gustavo Narea wrote:
Hello everybody.

I'm trying to use the Advanced PHP Debugger (APD), but it generates no output. Actually, It does generate a file, but with no content.

What's going on?

1.- I installed the APD by running `pear install APD` with no problem.
2.- Setup my php.ini file the same way as described in <http://php.net/apd>.
3.- Restarted my web server.
4.- Called the apd_set_pprof_trace() function at the first line of my script. 5.- Loaded the web page. I have error_reporting set to E_ALL and display_errors is enabled, but... PHP doesn't output errors, does it mean that everything was OK?

you would think that wouldn't you! but there is a possibility that
php is crashing and leaving no trace of the event - I have seen it happen
alot (I get the impression what I witnessed is related to the use of
__get()/__set() in php5 objects)

6.- When I open the file generated by APD, I realize it's empty.
7.- Anyway, I run `pprofp -R pprof.<number>.0`, but there's no output (not even an error message).

I was using PHP v5.0.4 and APD worked just fine, but I had to downgrade to PHP v5.0.3 and now I have this problem. In both versions of PHP I was using APD v1.0.1.

The fact that I had downgraded to v5.0.3 has nothing to do with this problem (IMO), as I deleted all of the files in the previous PHP directory prior to install PHP 5.0.3.

just because you have a pristine installation of php5.0.3 doesn't
necessarily mean that:

a, it's not broken.
b, APD actually works with that version.


TIA!

Cheers.

--- End Message ---
--- Begin Message ---
Hello, Jochem.

Thanks for your response.

I just filled a bug report because I realized there are many bugs like the one I have, specially with PHP v5.0.3.

Cheers!

Jochem Maas wrote:
Gustavo Narea wrote:
Hello everybody.

I'm trying to use the Advanced PHP Debugger (APD), but it generates no output. Actually, It does generate a file, but with no content.

What's going on?

1.- I installed the APD by running `pear install APD` with no problem.
2.- Setup my php.ini file the same way as described in <http://php.net/apd>.
3.- Restarted my web server.
4.- Called the apd_set_pprof_trace() function at the first line of my script. 5.- Loaded the web page. I have error_reporting set to E_ALL and display_errors is enabled, but... PHP doesn't output errors, does it mean that everything was OK?

you would think that wouldn't you! but there is a possibility that
php is crashing and leaving no trace of the event - I have seen it happen
alot (I get the impression what I witnessed is related to the use of
__get()/__set() in php5 objects)

6.- When I open the file generated by APD, I realize it's empty.
7.- Anyway, I run `pprofp -R pprof.<number>.0`, but there's no output (not even an error message).

I was using PHP v5.0.4 and APD worked just fine, but I had to downgrade to PHP v5.0.3 and now I have this problem. In both versions of PHP I was using APD v1.0.1.

The fact that I had downgraded to v5.0.3 has nothing to do with this problem (IMO), as I deleted all of the files in the previous PHP directory prior to install PHP 5.0.3.

just because you have a pristine installation of php5.0.3 doesn't
necessarily mean that:

a, it's not broken.
b, APD actually works with that version.


TIA!

Cheers.

--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

--- End Message ---
--- Begin Message ---
Hello,

Now I need to use curl to connect to a secure website,
I have three certificates files, two .cer files and one .pfx file.
After I import the certificates into IE browser, the visit is OK.
However, when I use curl_setopt to configure the certificates, it failed.
Can anybody help me?
Thanks.

The code is below:
<?
$ch = curl_init();

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes1.cer');
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes2.cer');
curl_setopt($ch, CURLOPT_SSLKEY, 'G:\test\ssl\xxxx.pfx');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD,'password');
curl_setopt($ch, CURLOPT_URL, $host.$uri);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$returned = curl_exec($ch);

echo $returned;
?>

lhb

--- End Message ---
--- Begin Message ---
should it not be:-
 G:\\test\ssl\mes1.cer'

notice how I changed the path to reflect a proper windows drive path!


James





lhb wrote:
Hello,

Now I need to use curl to connect to a secure website,
I have three certificates files, two .cer files and one .pfx file.
After I import the certificates into IE browser, the visit is OK.
However, when I use curl_setopt to configure the certificates, it failed.
Can anybody help me?
Thanks.

The code is below:
<?
$ch = curl_init();

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes1.cer');
curl_setopt($ch, CURLOPT_SSLCERT,'G:\test\ssl\mes2.cer');
curl_setopt($ch, CURLOPT_SSLKEY, 'G:\test\ssl\xxxx.pfx');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD,'password');
curl_setopt($ch, CURLOPT_URL, $host.$uri);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$returned = curl_exec($ch);

echo $returned;
?>

lhb

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

Chris wrote:


check your SMTP settings in the PHP.ini file.

--- End Message ---
--- Begin Message ---
Bruno B B Magalhães wrote:
Hi Jochem,

well, thanks for the code... it's working perfect, but it seams a little bit slow as it's using while... doesn't?

slow as compared to what? - its a very basic loop.
maybe a foreach loop would run quicker but unless you we're calling
this method 10,000s of times per request I doubt you see any difference.

I don't actually know which would be theoretically faster anyway.


Now, abusing of you, how can I unset a variable the same recursive way? :D Maybe like this?

not to seem rude - but have you bothered to try it out?
looks like it should work btw.



/ ***********************************************************************
    * @function_name get_var
    * @function_type Method
    * @function_input None
    * @function_description None
***********************************************************************/
    function get_var()
{ $arguments = func_get_args(); if(empty($arguments))
        {
            return null;
        }
$reference =& $this->vars; while($argument = array_shift($arguments))
        {
            if(!isset($reference[$argument]))
            {
                return null;
            }
            else
            {
                $reference =& $reference[$argument];
            }
        }

        unset($reference);
    }


And I didn't double posted, I had to subscribe... and I didn't know if my message had been sent or not.

righto - no big deal either way :-) it might get annoying if double posted
all day every day though ;-)


Thanks,
Bruno B B Magalhaes


--- End Message ---
--- Begin Message ---
Justin Cook wrote:
Before I came to my company, they created a Redhat server for our web server. Of course they let the redhat installer install PHP. It all works great but now I need to compile a module into php. Is this possible to do without causing havok? Bascially we really can't have more downtime that it would take to stop and start Apache.
Would the best solution be to download the php source, compile it into the 
directory it is installed into now, but only compile with the new module or 
will I need to compile it using the --with-apxs and all of the other modules 
that it is already compiled with? I would rather not have to recompile with all 
of the options that it is compiled with now.

I don't like redhat - I would take the time to build it manually (avoids redhat
from updating your php install)

steps to take:

1. download source
2. compile (with alll req. modules)
3. do a 'make test'
4. install
5. edit/check the relevant conf files.
6 restart apache

in theory your done, in practice something might bite you in the ass ...
oh and then there is the issue of making sure that the redhat package manager 
really
won't overwrite your handbuilt php install (cannot for the life of me remember 
what you have
to do to make redhat ignore the php install).


Thanks for you help!

--- End Message ---
--- Begin Message ---
On 7 Feb 2006, at 11:13, Jochem Maas wrote:

in theory your done, in practice something might bite you in the ass ... oh and then there is the issue of making sure that the redhat package manager really won't overwrite your handbuilt php install (cannot for the life of me remember what you have
to do to make redhat ignore the php install).

This might be of help: http://www.ae.iitm.ac.in/pipermail/ilugc/2005- August/020152.html

You can edit those srpms to include whatever configure line switches you need.

I run RHEL4, and my own compile of PHP, set up outside of rpm. You only need to worry about rpm getting confused if you use it to install any packages that are dependent on php, e.g. squirrelmail. Essentially either do ALL of your PHP setup and install through rpm or none of it. I'm quite happy handling PHP myself, and conflicts are rare as php is rarely a dependency for apps installed through rpm.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

--- End Message ---
--- Begin Message --- I am having great difficulty understanding dates and times with PHP and MySql.

As far as I understand them, the PHP date and time construct is timezone and DST aware, but MySql's DATETIME and TIMESTAMP fields are not. I believe that this is where my confusion originates from.

After searching the web and the docs for hours, I have not managed to find an article that explains how this system works and what the best practices are for an application that may be used in many timezones, some with DST and some without.

Please point me in the direction of a good source on this subject. I am new to PHP, coming from a several-year-long period of C++ and, recently, ASP.NET. (Ok, I admit it, I only started using PHP a week ago!)

BTW: I've loved every minute of it! PHP Rocks!

--- End Message ---
--- Begin Message ---
Stephen Martindale wrote:
I am having great difficulty understanding dates and times with PHP and MySql.

As far as I understand them, the PHP date and time construct is timezone and DST aware, but MySql's DATETIME and TIMESTAMP fields are not. I believe that this is where my confusion originates from.

After searching the web and the docs for hours, I have not managed to find an article that explains how this system works and what the best practices are for an application that may be used in many timezones, some with DST and some without.

Please point me in the direction of a good source on this subject. I am new to PHP, coming from a several-year-long period of C++ and, recently, ASP.NET. (Ok, I admit it, I only started using PHP a week ago!)

BTW: I've loved every minute of it! PHP Rocks!


Stephen,

I don't know what is considered standard, but for the apps that I have worked on, including php and c++, timestamps are always stored in GMT and presented in the local timezone. In the case of the database, the timestamp is GMT and another field is used to store the timezone offset. The timezone offset changes in regards to DST. For example NYC is -5 hours part of the year and -4 hours. Hope this helps.

Chris

--- End Message ---
--- Begin Message ---
"Stephen Martindale" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am having great difficulty understanding dates and times with PHP and 
>MySql.
>
> As far as I understand them, the PHP date and time construct is timezone 
> and DST aware, but MySql's DATETIME and TIMESTAMP fields are not. I 
> believe that this is where my confusion originates from.
>
> After searching the web and the docs for hours, I have not managed to find 
> an article that explains how this system works and what the best practices 
> are for an application that may be used in many timezones, some with DST 
> and some without.
>
> Please point me in the direction of a good source on this subject. I am 
> new to PHP, coming from a several-year-long period of C++ and, recently, 
> ASP.NET. (Ok, I admit it, I only started using PHP a week ago!)

I wrote a time class in PHP, and use it to manage all my dates and times. 
Basically, I use an INT to store the timestamp in the database, which is a 
simple timestamp (see PHP functions: time(), date(), strtotime(), mktime(), 
, strftime()).

DanB

--- End Message ---

Reply via email to