Jump to content

error meaning


Go to solution Solved by mindapolis,

Recommended Posts

I changed the database  name     $db = new PDO("mysql:host=$hostname;dbname=hercules.xymmetrix.net", $username, $password);

but it say SQLSTATE[42000] [1044] Access denied for user 'mediasvcunltd'@'monolith.xymmetrix.net' to database 'hercules.xymmetrix.net'

Link to comment
https://forums.phpfreaks.com/topic/299464-error-meaning/#findComment-1526304
Share on other sites


<?php
require_once('functions.php');
$hostname = "hercules.xymmetrix.net";
$username = "...";
$password = "...";
try {

$db = new PDO("mysql:host=$hostname;dbname=hercules.xymmetrix.net", $username, $password);

echo 'Connected to database';
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<form action ="contactUs.php" method="post">
<label>
<input id = "fname" type="text" name="fname" size="15" placeholder="First Name" value ="<?php echo !empty($_POST['fname']) ? $_POST['fname'] : '';?>" > <?php echo !empty($error['fname']) ? $error['fname'] : '';?>
<input type="text" name="lname" size="20" placeholder="Last Name"><?php echo !empty($error['lname']) ? $error['lname'] : '';?>
<input type="text" name="orgName" placeholder="Organization's Name"maxlength="50">
</label><br />
<label> <!--new row -->
<input id = "address" type="text" name="address" size="15" placeholder="Street Addresss" maxlength="50">
<input id = "city" type="text" name="city" placeholder="City" size="10" maxlength="25">
<select id = "state" name = "state" placeholder="State" value="">
<option value ="Please choose a state">
Please choose a state
</option>
<?php states($state); ?>
</select>
<input id = "zipcode" type="number" name="zipcode" placeholder="Zip Code" size="5" maxlength="5">
</label><br />
<label> <!--new row -->
<input type="text" name="phone" placeholder="Phone Number:(including area code)" size="10" maxlength="10">
</label>
<input type="text" name="fax" size="10" placeholder="Fax Number: (including area code)" maxlength="10">
</label><br />
<label> <!--new row-->
<input type="text" id = "email" name="email" placeholder="Email Address" />
<input type="text" id = "confirmEmail" name="ConfirmEmail" placeholder="Confirm Email Address" />
</label><br />
<label> <!--new row -->
What would you like help with?
<table id="projectOptions">
<tr span=2>
<td><input type="checkbox" name="SocialMedia">Social Media </td>
<td><input type="checkbox" name="WebContentManagement">Web Content Management </td>
</tr>
<tr>
<td><input type="checkbox" name="MarketingMaterials">Marketing Material Creation </td>
<td><input type="checkbox" name="SEO">SEO (Search Engine Optimization) </td>
</tr>
<tr>
<td><input type="checkbox" name="VideoEditing"> Video Editing </td>
<td><input type="checkbox" name="WebDesign">Web Design </td>
</tr>
</table>
</label>
Overview about the project:<textarea rows="5" cols="10" placeholder="Overview of Project"></textarea> <br />
If you are not a robot, what year is it? <input type="text" name="year" size="4" maxlength="4"><br />
<input type="submit" name="submit" value="Contact Me!">
<input type="reset" name="reset" value="Cancel">
</form>
</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/299464-error-meaning/#findComment-1526307
Share on other sites

I'm fairly sure the name of your database is not hercules.xymmetrix.net. That might be the hostname, but not the actual database name.

 

Since trial-and-error won't help in this situation, you'll have to figure out your database credentials. What does your old code say?

  • Like 1
Link to comment
https://forums.phpfreaks.com/topic/299464-error-meaning/#findComment-1526313
Share on other sites

I'm sorry I got confused.  The hostname is hercules.xymmetrix.net and the database name is www_media_services_unlimited but I'm getting get the same error. 

 

SQLSTATE[42000] [1044] Access denied for user 'mediasvcunltd'@'monolith.xymmetrix.net' to database ' www_mediaservicesunlimited_com'

$hostname = "hercules.xymmetrix.net";
$username = "";
$password = "";
try {
	
    $db = new PDO("mysql:host=$hostname;dbname=	www_mediaservicesunlimited_com", $username, $password);
    
    echo 'Connected to database';
    }
catch(PDOException $e)
    	{
    echo $e->getMessage();
    }
Link to comment
https://forums.phpfreaks.com/topic/299464-error-meaning/#findComment-1526504
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.