这是我用来尝试更新SQL数据的代码。 我一直有错误可以让任何人向我展示正确的代码吗?
在那里,他们说文件如果通过就应该返回1,如果失败则返回0 http://offertoro.com/docs/postback
代码是针对Offertoro报价墙的,我真的很想让它与我的网站合作,所以我终于可以让我的用户更多地做:) 任何帮助是极大的赞赏。 非常感谢你
<?php
$servername = "ooo";
$username = "ooo";
$password = "ooo";
$dbname = "ooo";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$id = $_GET["id"];
$old = $_GET["old"];
$o_name = $_GET["o_name"];
$amount = $_GET["amount"];
$cy_name = $_GET["cy_name"];
$user_id = $_GET["user_id"];
$sig = $_GET["sig"];
$payout = $_GET["payout"];
if(!isset($_SESSION['username'])) {
echo '<script type="text/javascript" language="Javascript">
alert("Not Logged In")
</script> ';
}else{
$result = mysql_query("SELECT meta_value FROM eiwi_usermeta WHERE user_id LIKE '$user_id' LIMIT 1" );
$row = mysql_fetch_object($result);
$meta_value = $row->meta_value;
$meta_value = $meta_value + $amount;
mysql_query("UPDATE eiwi_usermeta SET meta_value='$meta_value' WHERE user_id LIKE '$user_id' LIMIT 1");
if(!$query->execute())
$result = 0; // Problems executing SQL. Fail.
$dbh = null;
}
} catch (PDOException $e) {
}else{
$result = 0; // Security hash incorrect. Fail.
return $result;
答案 0 :(得分:0)
您没有在这里正确使用和关闭其他条件
catch (PDOException $e)
{
}else{
$result = 0; // Security hash incorrect. Fail.
return $result;