Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions