Public
Authored by Zandor Smith 💻

MySQL Connect

My usage:

Place connect.php in a folder called includes. The includes folder is in the root of the web application.

Then in any file I need to execute an SQL query to the database: include_once $_SERVER['DOCUMENT_ROOT'] . "/includes/connect.php";

Extra points to address

For using the $mysqli variable for executing queries and such (using OOP) in PHP, read the following articles;

For executing queries: http://php.net/manual/en/mysqli.query.php Note: I prefer to use Object Oriented style instead of the Procedural style.

For more information, consult: http://php.net/manual/en/class.mysqli.php

connect.php 307 Bytes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment