Hey guys, so here's what I'm trying to do:
I've made an HTTP script in the game Second Life, it uses an application/x-www-form-urlencoded url to send information to my Php script on my website. Here's the script:
<?php
define('DB_NAME', 'vangua01_access_list');
define('DB_USER', 'vangua01_admin2');
define('DB_PASSWORD', 'askljflnfldsakn');
define('DB_HOST', 'localhost');
$action=$_POST['action'];
if($action == 'connect')
{
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$link)
{
die('Connection failed: ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected)
{
die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}
else
{
echo('Connected to Database.');
}
}
if($action == 'post')
{
$avatarname = $_POST["avatarname"];
echo('Loading '.$avatarname);
$sql = "INSERT INTO vanguard_access (avatarname) VALUES ('$avatarname')";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
}
if($action == 'done')
{
echo('Closing connection..');
mysql_close();
}
?>
It communicates perfectly, and returns "Connected to database." So then it's told "post" which means names of users are about to be sent to be added to the database. This is where the problem starts. It successfully echos the names of the users I send to it, but each time it should insert them into the database, it returns the error: "Access denied for user 'vangua01'@'localhost' (using pass: NO)
I've checked the credentials a hundred times, made new databases, new admins (database users have been assigned all rights) with new passwords etc to no avail. I have a working other database which I use for my registration and login on my website, so, since I know it works I tried swapping the database and user login and pass info in this for the working one, and it still returned the same error..
I've been trying to figure this out for weeks, if someone could help at all I'd be extremely grateful, thanks! :)