PHP is a server-side, HTML-embedded scripting language that may be
used to create dynamic Web pages. It is available for most operating
systems and Web servers, and can access most common databases,
including MySQL. PHP may be run as a separate program or compiled as
a module for use with the Apache Web server.
PHP actually provides two different MySQL API extensions:
mysql: Available for PHP versions 4 and 5,
this extension is intended for use with MySQL versions prior to
MySQL 4.1. This extension does not support the improved
authentication protocol used in MySQL 4.1, nor does it support
prepared statements or multiple statements. If you wish to use
this extension with MySQL 4.1, you will likely want to configure
the MySQL server to use the --old-passwords
option (see Section A.1.2.4, âClient does not support authentication protocolâ). This extension is
documented on the PHP Web site at
http://php.net/mysql.
mysqli - Stands for âMySQL,
Improvedâ; this extension is available only in PHP 5. It
is intended for use with MySQL 4.1.1 and later. This extension
fully supports the authentication protocol used in MySQL 5.0, as
well as the Prepared Statements and Multiple Statements APIs. In
addition, this extension provides an advanced, object-oriented
programming interface. You can read the documentation for the
mysqli extension at
http://php.net/mysqli. A helpful article can be
found at
http://www.zend.com/php5/articles/php5-mysqli.php.
The PHP distribution and documentation are available from the
PHP Web site. MySQL
provides the mysql and mysqli
extensions for the Windows operating system on
http://dev.mysql.com/downloads/connector/php/. You
can find information why you should preferably use the extensions
provided by MySQL on that page.
MySQL Enterprise.Â
MySQL Enterprise subscribers will find more information about
MySQL and PHP in the Knowledge Base articles found at
PHP. Access to the MySQL Knowledge Base collection of
articles is one of the advantages of subscribing to MySQL
Enterprise. For more information see
http://www.mysql.com/products/enterprise/knowledgebase.html.
The date time functions that PHP supports, mysql doesn't. Although both have TIMESTAMP but earlier supports unix's timestamp whether latter has YYYYMMDDHHMMSS string in TIMESTAMP data type.
Posted by Chuiyuan Meng on September 25 2006 10:06am
Set the column type to "CHAR(10)" instead of "TimeStamp" if you want to store TimeStamp values from PHP. Otherwise neither will mysql store the value correctly nor will you be able to use the stored value as TimeStamp in PHP.
User Comments
The date time functions that PHP supports, mysql doesn't. Although both have TIMESTAMP but earlier supports unix's timestamp whether latter has YYYYMMDDHHMMSS string in TIMESTAMP data type.
Set the column type to "CHAR(10)" instead of "TimeStamp" if you want to store TimeStamp values from PHP.
Otherwise neither will mysql store the value correctly nor will you be able to use the stored value as TimeStamp in PHP.
You can select using UNIX_TIMESTAMP(field), so it will be ported to use like php expects.
Add your own comment.