filmov
tv
PHP Projects Easy Setup & Database setup

Показать описание
Ch.1 - Getting Started with PHP
Ch.2 - Creating Your First PHP Project
Open a text editor and type the following code-
?php
echo Hello, World!;
?
Place it in the htdocs folder inside your XAMPP or MAMP installation directory.
You should see Hello, World! displayed on the page.
Ch.3 - Setting Up Your Database
You will use a tool called phpMyAdmin to manage your MySQL databases.
Open your web browser and go to http-//localhost/phpmyadmin.
Click on the New button to create a new database.
Give your database a name, like my_database.
Here is an example of PHP code to connect to your MySQL database- ?php $servername = localhost; $username = root; $password = ; $dbname = my_database; // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn-connect_error) {
die(Connection failed- . $conn-connect_error); } echo Connected successfully; ?
Ch.2 - Creating Your First PHP Project
Open a text editor and type the following code-
?php
echo Hello, World!;
?
Place it in the htdocs folder inside your XAMPP or MAMP installation directory.
You should see Hello, World! displayed on the page.
Ch.3 - Setting Up Your Database
You will use a tool called phpMyAdmin to manage your MySQL databases.
Open your web browser and go to http-//localhost/phpmyadmin.
Click on the New button to create a new database.
Give your database a name, like my_database.
Here is an example of PHP code to connect to your MySQL database- ?php $servername = localhost; $username = root; $password = ; $dbname = my_database; // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn-connect_error) {
die(Connection failed- . $conn-connect_error); } echo Connected successfully; ?