Question: Start the database: systemctl start mariadb Login to the database: mysql - u root Set a password for root: set password = password (

Start the database: systemctl start mariadb
Login to the database: mysql -u root
Set a password for root: set password = password("passw0rd");
Create a database called addressbook: create database addressbook;
Make the addressbook database the current database: use addressbook;
Create a table called address: CREATE TABLE address (id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, lastname VARCHAR(30), firstname VARCHAR(30), phone VARCHAR(30), email VARCHAR(30));
Create a user to be used from the web application and set the password: create user 'www'@'localhost' identified by 'wwwUSERpass';
Give the www user permissions to the table: grant select, insert, delete, update on address to 'www'@'localhost';
Type quit to get out of mysql.
Edit /var/www/html/rds.conf.php to set the connection to match the settings you just created. The database is on the local server so the $RDS_URL variable should be set to localhost. $RDS_DB should be set to the name of the database you created. $RDS_user should be set to the name of the user you created to use from the web application. $RDS_pwd should be set to the password you gave the user when you created it.
Restart httpd.
Access the webapp by putting the IP address or dns name of your server followed by /addressbook.php in the browser. Did it work? It should show you a table and a link to add a contact. If you just put your IP address or domain name it will likely show you the index.html from the earlier learning module. If it did not work, check the troubleshooting steps below.
Once you get the Add Contact link test by adding a few records to your address book.
Make sure you have made the necessary modifications to have mariadb start at boot.
Edit /var/www/html/rds.conf.php to set the connection to match the settings you just created. The database is on the local server so the $RDS_URL variable should be set to localhost. $RDS_DB should be set to the name of the database you created. $RDS_user should be set to the name of the user you created to use from the webapp. $RDS_pwd should be set to the password you gave the user when you created it.
There are the variables that need to be set:
$RDS_URL
$RDS_DB
$RDS_user
$RDS_pwd
$RDS_URL is where the database is running and I told you what to set for that.
For the other 3 I said to make sure they match what was configured in the database. Here are the 2 commands where you should get the needed information:
create database addressbook;
create user 'www'@'localhost' identified by 'wwwUSERpass';
The user is www, not www@localhost.
';
?>
include('rds.conf.php');
// Set address book variables
isset($_REQUEST['mode'])? $mode=$_REQUEST['mode'] : $mode="";
isset($_REQUEST['id'])? $id=$_REQUEST['id'] : $id="";
isset($_REQUEST['lastname'])? $lastname=$_REQUEST['lastname'] : $lastname=""; isset($_REQUEST['firstname'])? $firstname=$_REQUEST['firstname'] : $firstname=""; isset($_REQUEST['phone'])? $phone=$_REQUEST['phone'] : $phone="";
isset($_REQUEST['email'])? $email=$_REQUEST['email'] : $email="";
// Connect to the RDS database
$connect=mysqli_connect($RDS_URL, $RDS_user, $RDS_pwd ) or die(mysqli_error($connect));
mysqli_select_db($connect, $RDS_DB ) or die(mysqli_error($connect));
if ( $mode=="add")
{
Print '

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!