Locker

时间:2016-08-09 01:48:10

标签: php url postback

让我解释这个故事,所以我开始一个网站,用户可以加入并跟踪网站上的内容,我想创建一个回复链接,使用更衣室代码将'支付'插入表中,但是当我尝试和测试它,它给了我这个错误

Execute failed: (2031) No data supplied for parameters in prepared statement

所以这是我用过的代码......

<?php

define("MYSQL_HOST", "localhost");
define("MYSQL_PORT", "3306");
define("MYSQL_DB", "dbuser");
define("MYSQL_TABLE", "userpayout");
define("MYSQL_USER", "user");
define("MYSQL_PASS", "dbpassweord");

$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;
}
$aff_sub1    =         $_GET['aff_sub'];
$aff_sub2   =         $_GET['aff_sub'];
$aff_sub3   =         $_GET['aff_sub'];
$aff_sub4   =         $_GET['aff_sub'];
$aff_sub5   =         $_GET['aff_sub'];
$aff_sub6   =         $_GET['aff_sub'];
$payout     =         $_GET['payout'];


if (!($stmt = $mysqli->prepare("UPDATE ".MYSQL_DB.".".MYSQL_TABLE." SET 
payout=payout+(?) WHERE aff_sub1=(?)"))) 
{
  echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
 }
$stmt->bind_param('ds', $aff_sub1, $aff_sub2, $aff_sub3, $aff_sub4, $aff_sub5, $aff_sub5, $payout);
if (!$stmt->execute()) 
{
  echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
else
{
  printf("%d Row updated, added $".$payout." to locker ".$aff_sub1." .\n",

mysqli_stmt_affected_rows($stmt));
}

?>

所以我试图跟踪多个aff_subs,这些是他们从中获得奖金的储物柜。我想将它插入具有相同affsubs的行中。

1 个答案:

答案 0 :(得分:0)

在调用$aff_sub1之前检查变量$aff_sub2payoutbind_param等,以确保它们已设置。

还要确保通过GET方法调用回发链接,因为您要从$_GET检索变量。