Question
PHP application Hi can you help me to set up name , user and password to credentials and connect.php bellow The database name is BB98982_db
PHP application
Hi can you help me to set up name , user and password to credentials and connect.php bellow
The database name is BB98982_db user BB98982 with password ^*J*P6529mS!LqQ4
Credentials.php
// Configure database
// TODO: Change these to match your own TT284 database credentials // Note that it is important to use single quotes for the password variable $database_user = 'here'; $database_password = 'PASSWORDHERE';
// OPTIONAL: Edit these lines if you're using another database $database_host = 'localhost'; $database_name = $database_user . '_db';
Connect.php
// For security, required PHP files should "die" if SAFE_TO_RUN is not defined if (!defined('SAFE_TO_RUN')) { // Prevent direct execution - show a warning instead die(basename(__FILE__) . ' cannot be executed directly!'); }
// Obtain database credentials from credentials.php require 'credentials.php';
// Check credentials if (empty($database_user) or $database_user == 'here') { die('$database_user in credentials.php is not set'); } if (empty($database_password) or $database_password == 'YOURPASSWORDHERE') { die('$database_password in credentials.php is not set'); }
// Connect to server and select database $database = mysqli_connect($database_host, $database_user, $database_password); if (!$database) { echo '
host: ' . htmlspecialchars($database_host) . ''; echo '
user: ' . htmlspecialchars($database_user) . ''; echo '
password: ' . htmlspecialchars($database_password) . ''; die('Unable to connect to database server!'); } if (!$database->select_db($database_name)) { echo '
name: ' . htmlspecialchars($database_name) . ''; die('Unable to select database: ' . $database->error); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started