I've an place statement I'm querying towards the DB.

$notes_sql = 'INSERT into notes SET
              order_id = "'.$_GET['order_id'].'",
              date_added = "'.$date_added.'",
              note_message = "'.$_SESSION['note_message'].'"';

$notes_result = $conn->query($notes_sql) or die(mysqli_error($conn));

I understand the sql statement is correct, because after i attempt to echo it and run that echo'd statement in phpMyadmin, it card inserts it fine.

After I attempt to run the place statement, I recieve the next error:

Place command refused to user 'ideapale_amquery'@'localhost' for table 'notes'

Line 74 may be the line type of code that queries the statement.

I additionally know that i'm properly hooking up towards the DB with an incorporated connection.php file, since i have am using variables from that incorporated file around the page I'm focusing on.

I am speculating I'm in some way not properly hooking up towards the DB, but I don't know what it's. I replicated the code with this page from another page that actually works fine, and so i do not understand why it's not working.

Exactly why is my place no longer working in php?

* UPDATE *

This really is my connection script:

function dbConnect($type) {
    if($type == 'query'){
        $user = 'ideapale_amquery';
        $pwd = 'xxxxxxxxxxx';
    } else if($type == 'admin') {
        $user = 'ideapale_amadmin';
        $pwd = 'xxxxxxxxxxxx';
    } else {
        exit('Unrecognized connection type');   
    }

$conn = new mysqli('localhost', $user, $pwd, 'ideapale_offorders') or die('Cannot open database');
return $conn;
}

This is the way I'm hooking up towards the connection script in the page I'm on:

$conn = dbConnect('admin');

I'm hooking up towards the DB while using admin rights, and so i do not understand why it thinks I wish to make use of the 'amquery' username.

You tell you they are hooking up using the ideapale_amadmin user, however the error message INSERT command denied to user 'ideapale_amquery'@'localhost' for table 'notes' reveals that you're not. You're while using wrong MySQLi object (i.e. an association you produced previously within the script) or are passing the incorrect parameter to dbConnect().

Try

$notes_result = $conn->query($notes_sql) or die(mysqli_error($conn)); 

To obtain an up-to-date error.

When the echoed SQL works fine you need to guess it is a connection or permissions problem. Are you currently doing an place elsewhere?

Edit: Therefore it is a permissions problem, run this:

GRANT INSERT PRIVILEGES ON *.* TO 'ideapale_amquery'@'localhost' 

However, if you do not believe you have to, do this first:

SHOW GRANTS FOR 'ideapale_amquery'@'localhost'

You can examine and find out exactly what the error being came back is.

Change: die(mysqli_error())
To: die(mysqli_error($conn))