harshraj22 / harshraj22/Automated_Payroll
unable To Run Automate.php File
- Dominant language
- PHP
- Stars
- 3
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\my-site\Automated_Payroll-develop\Payroll\automate\automate.php on line 4
Error while connecting to database.Access denied for user 'root'@'localhost' (using password: YES)
AUTOMATE.PHP
==========
";
}
// create the database.
$db_create_query = "CREATE DATABASE {$database}";
$db_create_result = mysqli_query($conn, $db_create_query);
if(!$db_create_result)
die("Error creating database. ".mysqli_error($conn));
else
echo "Successfully created Database.
";
mysqli_close($conn);
// ------------------------Database Created, Now creating admin table -----------------------------
$conn = mysqli_connect($hostname, $username, $password, $database);
if(!$conn)
die("Error connecting database.
".mysqli_connect_error());
else
echo "Connected to databse, creating tables.
";
// create auth table which stores username and password for each user, along with info it he/she is admin
$table_query = "CREATE TABLE auth (username VARCHAR(20) NOT NULL PRIMARY KEY, pass VARCHAR(20) NOT NULL, isAdmin VARCHAR(3) NOT NULL DEFAULT 'No', isHr VARCHAR(3) NOT NULL DEFAULT 'No')";
$table_result = mysqli_query($conn, $table_query);
if(!$table_result)
die("Error creating authentication table.
".mysqli_error($conn));
else
echo "Successfully created auth table.
";
// create an admin auth credentials.
$create_admin_query = "INSERT INTO auth VALUES('{$admin_name}', '{$admin_pass}', 'yes', 'No')";
$create_admin_result = mysqli_query($conn, $create_admin_query);
if(!$create_admin_result)
die("Error creating admin.
".mysqli_error($conn));
else
echo "Successfully Created admin.
";
//--------------------------------HR Table Creation----------------------------------------------------
$create_hr_table = "CREATE TABLE hr_table (username VARCHAR(30) NOT NULL PRIMARY KEY, rate INT (3) DEFAULT 10)";
$create_hr_table_result = mysqli_query($conn, $create_hr_table);
if(!$create_hr_table_result)
die("Error creating hr table.
");
else
echo "Successfully Created HR table.
";
function removeDirectory($path) {
$files = glob($path . '/*');
foreach ($files as $file) {
is_dir($file) ? removeDirectory($file) : unlink($file);
}
rmdir($path);
return;
}
removeDirectory('../user_images');
mysqli_close($conn);
?>
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with automate/automate.php at line 4 and inspect the required ../login.php for the configured MySQL connection values. Reproduce the access-denied error in the XAMPP environment, then determine and document or implement the intended connection setup so the script can connect and proceed with database creation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100