mysql_query() Access denied for user

ewfdkgvwmv

New Member
I'm making a PHP and MySQL RPG game, and my changeEquipment page is not working. I'm getting these errors:\[quote\] Warning: mysql_query() [function.mysql-query]: Access denied for user 'devinfa1'@'localhost' (using password: NO) in /home/devinfa1/public_html/spellsword/changeEquipment.php on line 21 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/devinfa1/public_html/spellsword/changeEquipment.php on line 21 Warning: mysql_query() [function.mysql-query]: Access denied for user 'devinfa1'@'localhost' (using password: NO) in /home/devinfa1/public_html/spellsword/changeEquipment.php on line 27 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/devinfa1/public_html/spellsword/changeEquipment.php on line 27\[/quote\]Here's my code:\[code\]<?php// Get commonFunctions.phprequire_once('commonFunctions.php');// Start the session and connect to the databasesession_start();$con = mysql_connect("localhost","devinfa1_user","dbpass");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("devinfa1_spellsword", $con); // If logged inif(isset($_SESSION['account_name'])) { // If form is submitted if(isset($_POST['submit']) || isset($_POST['submit_x'])) { // If the hero has more than one weapon if(hero_has_multiple_weapons()) { // Set new weapon mysql_query("UPDATE Hero_Weapons SET active_weapon = TRUE WHERE HW_hero_id = (SELECT hero_id FROM Heroes WHERE hero_name = '$_SESSION[hero_name]') AND HW_item_id = (SELECT item_id FROM Items WHERE item_name = '$_POST[weapon]')"); // Unset previous weapon if(isset($_SESSION['hero_name'])) { mysql_query("UPDATE Hero_Weapons SET active_weapon = FALSE WHERE HW_hero_id = (SELECT hero_id FROM Heroes WHERE hero_name = '$_SESSION[hero_name]') AND HW_item_id = (SELECT item_id FROM Items WHERE item_name = '$_SESSION[weapon_name]')"); } }// Close the database connectionmysql_close($con);?>\[/code\]So, the PHP should be connecting to my databse using the \[code\]devinfa1_user\[/code\] username and \[code\]dbpass\[/code\] password, but it's apparently trying to use the \[code\]devinfa1\[/code\] username with no password.I have no idea why this is the case, because I have the exact same connection code and an update statement on my changeHero page and it works perfectly. Any ideas?
 
Back
Top