I'm a little stumped here because I've been doing it right along...I write a little application, data gets put into it, user hit's submit, it get's fed to the db and a result page is shown (usually with the submitted data so user can correct if they find errors)
Problem this time is I'm getting an error. Here's the code:
And here is the error when I hit submit :PHP Code:<?
$db_name = "dbname";
$table_name = "table";
$connection = @mysql_connect("localhost", "username", "password") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "INSERT INTO $table_name (Name, Age, History, Recruiting, Email, IM, Charname, Charage, Bio, Strengths, WhatShip,
Responsibilities, Sample) VALUES ('$_POST[Name]', '$_POST[Age]', '$_POST[History]', '$_POST[Recruiting]', '$_POST[Email]',
'$_POST[IM]', '$_POST[CharName]', '$_POST[Charage]', '$_POST[Bio]', '$_POST[Strengths]', '$_POST[WhatShip]',
'$_POST[Responsibilities]', '$_POST[Sample]')";
$result = @mysql_query($sql, $connection) or die(mysql_error());
?>
Access denied for user 'username'@'localhost' to database 'dbname'
If someone would like to see firsthand the sheet i'm using, please go to http://www.ussretribution.com/coappli.htm The submit button is linked to the code above. The rest of the sheet that contains the php code is just the return page showing the user what they did.
Quite frankly, I can't see why it doesn't work and am at a loss here. Any help anyone can offer would be greatly appreciated. (Just got haircut so none left to pull out)





Reply With Quote