For some time I discovered how to make a connection between a PHP document (script) and a MySQL database. To create dynamic sites that write and read a database is needed to introduce Â into a PHP file that creates a connection between the two of them. This is a used predefined PHP function mysql_connect and can be invoked whenever we need a connection to a database.
There is a need to define the following variables:
localhost = server where the database is stored. Usually this variable is denoted with localhost as the database is on the same server as the website.
mysql_user = user with access to a database that we care. This user must have write access, delete and modify the data contained in the database.
mysql_password = user password required to connect to the database.
The syntax of connection is then arranged as in the example below:
NoteÂ thatÂ if theÂ connectionÂ is notÂ madeÂ â€‹â€‹anÂ error messageÂ appearsÂ andÂ ifÂ the connectionÂ isÂ madeÂ â€‹â€‹the message “SuccessfullyÂ Connected”.
I will returnÂ andÂ otherÂ aspectsÂ of theÂ typesÂ of connections.