回发执行失败:(2031)在预准备语句中未提供任何参数数据

时间:2018-07-13 18:16:03

标签: php mysql sql mysqli mariadb

这是我每次显示的postback.php代码

执行失败:(2031)在准备好的语句中没有为参数提供数据

我不知道我在哪里出错,请帮帮我 我已经搜索过,但没有找到解决方案

define("MYSQL_HOST", "localhost");
define("MYSQL_PORT", "xxxx");
define("MYSQL_DB", "u530xxxx312_tap");
define("MYSQL_TABLE", "taxxx");
define("MYSQL_USER", "u5xxxx312_naxxxb");
define("MYSQL_PASS", "Mcxxxx455");

// Connecting to database, using MySqli
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
if ($mysqli->connect_errno) {
    echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}

// Setup postback variables
$uid            = $_POST['uid'];
$tid            = $_POST['tid'];
$cpid           = $_POST['cpid'];
$api_token      = $_POST['api_token'];
$payout_amount  = $_POST['payout_amount'];
$revenue        = $_POST['revenue'];

// Insert log into database
if (!($stmt = $mysqli->prepare("INSERT INTO ".MYSQL_DB.".".MYSQL_TABLE." (uid, tid, cpid, api_token, payout_amount, revenue) VALUES (?, ?, ?, ?, ?, ?)"))) {
  echo "Preparation failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
$stmt->bind_param('sssssss', $uid, $tid, $cpid, $api_token, $payout_amount, $revenue);

if (!$stmt->execute()) {
  echo "Execution failed: (" . $stmt->errno . ") " . $stmt->error;
} else {
  printf("Added new conversion with uid: ".$uid." .\n");
}

0 个答案:

没有答案