Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with the following. I do not have a password set so do i just leave it

ID: 3572465 • Letter: N

Question

Need help with the following. I do not have a password set so do i just leave it blank? And it is on my own machine so i am using localhost..

my code:

<?php # Script 9.2 - mysqli_connect.php

// This file contains the database access information.
// This file also establishes a connection to MySQL,
// selects the database, and sets the encoding.

// Set the database access information as constants:
DEFINE ('DB_USER', 'root');
DEFINE ('DB_PASSWORD', '');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'baseball_stats');

// Make the connection:
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );

// Set the encoding...
mysqli_set_charset($dbc, 'utf8');

Create the a9mysqli_connect.php file based on the mysqli_connect.php file used in Ch09. Requirements are as follows: (12 Points)

a. Supply a username that you use to maintain the baseball_stats database for the DB_USER constant perhaps root if you have not set up any other usernames. (2 points)

b. Supply the password for the DB_PASSWORD constant that you use for the username. (2 points)

c. Supply the hostname of the server that you use for the DB_HOST constant. If it is your personal webserver, use localhost. (2 points)

d. Supply baseball_stats as the DB_NAME given that you created the baseball_stats database in Weeks 13 and 14. (2 points)

e. Save the a9mysqli_connect.php file in the following path on your webserver: htdocs/Ch09/. (2 points)

f. You can test it and if all goes well you will get a blank page. If you made an error supp

Explanation / Answer

If you donot have password for database then leave it blank.

If the database is running on your local machine then use either localhost or 127.0.0.1 as DB_HOST

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote