Consider this database:

```
var1    int(10) Auto Increment   
var2    varchar(255)     
var3    int(10)  
var4    tinyint(1) unsigned  
var5    int(10)  
var6    tinyint(1) unsigned [0]  
var7    tinyint(1) unsigned [0]

```

I have a page on one domain that contains some jQuery which makes a JSONP GET to a .php script on another domain:

Client jQuery:

```
$.ajax({
    url:        "https://1.2.3.4/xxx/xxx.php",
    timeout:    5000,
    data: {     "var1":     "xxx",
                "var2":     "xxx",
                "var3":     "xxx",
                "var4":     "xxx",
                "var5":     "xxx",
                },
    dataType: "jsonp",
    success: function(data) {
    alert(data);
    },
});

```

Server PHP:

```
<?php
header('content-type: application/json; charset=utf-8');
header("access-control-allow-origin: *");

if($_SERVER['HTTP_REFERER'] != "xxx" || !isset($_GET['callback']))
{
    sendResponse(400, 'Invalid request');
    exit();
}

// Check for required parameters
if (    isset($_GET["var1"]) && 
        isset($_GET["var2"]) && 
        isset($_GET["var3"]) &&
        isset($_GET["var4"]) &&
        isset($_GET["var5"]))
{
    if($_GET["var1"] == "xxx")
    {
        $var2    = $_GET["var2"];
        $var3    = intval($_GET["var3"]);
        $var4    = intval($_GET["var4"]);
        $var5    = intval($_GET["var5"]);

        $db = new mysqli('localhost', 'root', 'xxx', 'xxx');
        $db->autocommit(FALSE);

        $result = $db->query("INSERT INTO xxx (`xxx`, `xxx`, `xxx`, `xxx`) VALUES ('$var2', $var3, $var4, $var5)");
        $requestID = $db->insert_id;

        $data = array("requestID" => $requestID, "errorMessage" => $db->error);

        echo $_GET['callback'] . '('.json_encode($data).')';  
    }
}
?>

```

It looks like the INSERT works. I get a valid 'insert\_id' back in the JSON. I've also tried returning the number of affected rows, which shows '1'. But for some reason when I look at that table afterwards, there are no rows in the table?

I can manually insert into that table using the same INSERT statement whilst logged in as the same user ('root' - just to try and narrow it down!). I don't get any PHP errors, and `$db->error` returns nothing. If I look at the table in MySQL afterwards, the auto increment ID field has gone up by one - but no data exists.

Any ideas?!