Forum Moderators: open
Access denied for user 'dbusername'@'localhost' (using password: YES) in /home/hostusername/public_html/quoteform.php on line 18
<form action="" method="post">
<fieldset>
<legend>Add a Quote</legend>
<label for="quote">Quote:</label>
<input type="text" name="quote" id="quote" maxlength="1500" />
<label for="author">Author:</label>
<input type="text" name="author" id="author" maxlength="60" />
<input type="submit" value="Add Quote" />
</fieldset>
</form>
<?php
$user="mydbusername";
$password="dbpw";
$database="dbname";
$connection = mysql_connect('localhost',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
if ($_REQUEST['quote'] != "") {
if($_REQUEST['author'] != "") {
$author = $_REQUEST['author'];
} else {
$author = "Anonymous";
}
$quote = $_REQUEST['quote'];
$query="INSERT INTO `quote` (`quote`,`source`) values ('" . mysql_real_escape_string($quote) . "','" . mysql_real_escape_string($author) . "')";
$result = mysql_query($query) or die(mysql_error());
echo("inserted quote: " . htmlentities($quote) . " by " . htmlentities($author) . " into database");
} else {
echo("<p>Please enter a quote and author</p>");
}
?>
UPDATE
mysql.user
SET
Password = OLD_PASSWORD('dbpw')
WHERE
Host = 'localhost'
AND User = 'mydbusername';
FLUSH PRIVILEGES;