image


Valora:  4/5
Inicio » PHP » PHP Tutorial » Database access




Create the database

In the making of this course about PHP with databases access, we have chosen MySQL database because it is free and also because it is the most widely used in UNIX environment. To this end, the server where the pages are hosted must provide us with tools to create the database or have access to Telnet.

The command to create a MySQL database is the following:

mysqladmin -u root create data_base

Con este comando conseguimos crear la una base de datos en el servidor de bases de datos de nuestro servidor.

Once we achieve this, we will create the database tables; the description of the tables includes the structure of the information to be stored in them. In order to do this, we will use the consulting language SQL, common to all related databases.


In this example, we have created a table called test with 3 fields: one identifier field that will be used to particularly identify one row with the value of said field, another field with the name of a person and the last field with the last name of said person.

To create the table you can use your web server's MySQL administration tool or you can write a text file with the content of the equivalent SQL and then indicate the database engine to execute it with the following instruction:

mysql -u root base_datos <test.sql

test.sql







WebEstilo.com - Introduzca su e-mail y conozca las novedades. No hacemos Spam.
Google
  Web WebEstilo.com   
 
Valid HTML 4.01!
Última modificación:25 de Diciembre de 2004. Spain - España.
© 1998-2004 por Joaquin Gracia. Todos los derechos reservados.