connection denied: error message

baucuml

New Member
Messages
5
Reaction score
0
Points
1
Hello, I am trying to access my database through a PHP script and I keep getting access denied. I have double checked that my credentials are correct in my script according to my database page that has the credentials. I have already checked that my privileges are enabled for the database user. I have even tried to create a new user and I still couldn't gain access. I have access to the database through my x10 control panel and PHPMyAdmin. My script is on my x10hosting site and the files are uploaded into my x10hosting file manager.
 

ctyrd

Active Member
Messages
954
Reaction score
80
Points
28
I have access to the database through my x10 control panel and PHPMyAdmin.
Sounds like the config script. What are you using for the database host, localhost?
 
Last edited:

baucuml

New Member
Messages
5
Reaction score
0
Points
1
This is my script and as you can see I am using localhost.
<?php
$servername = "localhost";
$username = "qdfjfswb_ctec393";
$password = "Pa$sw0rd";
$dbname = "qdfjfswb_ctec393";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO Jobs (Job_ID, Cost, Service_Name) VALUES ('".$_POST['job_id']."', '".$_POST['cost']."', '".$_POST['service_name']."')";
if ($conn->query($sql) === TRUE) {
header("Location: confirmfp.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
 

ctyrd

Active Member
Messages
954
Reaction score
80
Points
28
Hello, I am trying to access my database through a PHP script and I keep getting access denied. I have double checked that my credentials are correct in my script according to my database page that has the credentials. I have already checked that my privileges are enabled for the database user. I have even tried to create a new user and I still couldn't gain access. I have access to the database through my x10 control panel and PHPMyAdmin. My script is on my x10hosting site and the files are uploaded into my x10hosting file manager.
Looks like it should work. Requesting review via discord.
 
Top