PHP/MySQL Tutorial - PHP MySQL Connection
PHPinfo
One of the most basic PHP tags is the PHPinfo. Open just any text editor (like notepad) and type in the following:
<?
phpinfo();
?>
And save it as phpinfo.php
Now upload this to your public_html directory and go to it in your browser using the following link:
http://yourdomain.com/phpinfo.php
You will see a huge page with all the details of the PHP installation on it, scroll down through all this information and you will see a section where the MySQL details are fitted.
Before you can do anything with your database, you must create a table. A table is a section of the database for storing related information. In a table you will set up the different fields which will be used in that table. Because of this construction, nearly all of a site's database needs can be satisfied using just one database.
Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. You will then be taken to a setup screen where you must create the fields for the database. If you are using a PHP script to create your database, the whole creation and setup will be done in one command.

Creating a table in PHP is slightly more difficult than with MySQL. It takes the following format:
CREATE TABLE tablename {
Fields
}
The fields are defined as follows:
fieldname type(length) extra info,
The final field entered should not have a comma after it.
|