使用php到html文件从数据库中检索数据[关闭]

使用php到html文件从数据库中检索数据[关闭]

问题描述:

I am trying to make a commenting system that saves a comment to MYSQL database and retrieve it once its submitted to the HTML form. I am pretty sure there is an easy way to do that but I cannot find anything specific on the internet.

So how is the basic way to retrieve something from a MYSQL database to HTML page.

我正在尝试建立一个评论系统,将评论保存到MYSQL数据库并在提交给HTML后检索它 形成。 我很确定有一种简单的方法可以做到这一点,但我在互联网上找不到任何具体内容。 p>

那么从MYSQL数据库检索某些内容到HTML页面的基本方法如何。 p> div>

For the beginning search for PDO tutorials. That is a quiet powerfull framework for database access.

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

PDO ships with PHP 5.1, and is available as a PECL extension for PHP 5.0; PDO requires the new OO features in the core of PHP 5, and so will not run with earlier versions of PHP.