gpt4 book ai didi

php - 删除注释时出现奇怪的 PHP 错误

转载 作者:行者123 更新时间:2023-11-29 22:06:55 24 4
gpt4 key购买 nike

我有以下代码:(第一行是数字172)

                if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) 
{

$buyerName = $httpParsedResponseAr["FIRSTNAME"].' '.$httpParsedResponseAr["LASTNAME"];
$buyerEmail = $httpParsedResponseAr["EMAIL"];
/*
//Open a new connection to the MySQL server
$mysqli = new mysqli('My stuff, not giving you meh passwords xD');

//Output any connection error
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}

$insert_row = $mysqli->query("INSERT INTO BuyerTable
(BuyerName,BuyerEmail,TransactionID,ItemAmount)
VALUES ('$buyerName','$buyerEmail','$transactionID',$ItemTotalPrice);

if($insert_row){
print 'Success! ID of last inserted record is : ' .$mysqli->insert_id .'<br />';
}else{
die('Error : ('. $mysqli->errno .') '. $mysqli->error);
}
*/

echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
} else {
echo '<div style="color:red"><b>GetTransactionDetails failed:</b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';

}

看到那个多行注释了吗?当我删除它时,出现以下错误:

Parse error: syntax error, unexpected 'color' (T_STRING) in *path to file* on line 201

我不知道什么会导致这个问题,因为第 201 行是

echo '<div style="color:red"><b>GetTransactionDetails failed:</b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';

里面甚至没有“颜色”!请帮我解决这个问题,我不知道该怎么办了。也尝试注释掉该行,但没有效果。这是系统中的错误还是我的代码中的错误?

最佳答案

您在 $ItemTotalPrice 之后缺少 sql 语句中的最后一个双引号

$insert_row = $mysqli->query("INSERT INTO BuyerTable 
(BuyerName,BuyerEmail,TransactionID,ItemAmount)
VALUES ('$buyerName','$buyerEmail','$transactionID',$ItemTotalPrice);

关于php - 删除注释时出现奇怪的 PHP 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32077826/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com