可捕获的致命错误:类mysqli_result的对象无法转换为字符串

时间:2014-02-08 14:09:07

标签: php mysqli verifyerror

我想从我的ebank创建验证页面,e bank发送波纹管参数:

$Status = $_POST['status'];
$Refnumber = $_POST['refnumber'];
$Resnumber = $_POST['resnumber'];
        $res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber ));
$Status = $res->verifyPaymentResult->ResultStatus;
$PayPrice = $res->verifyPaymentResult->PayementedPrice;

我希望使用以下代码将数量添加到用户数据库:

    $MerchantID = 'xxxxx';
$Password = 'xxxxx';




if(isset($_POST['status']) && $_POST['status'] == 100){



    $Status = $_POST['status'];
    $Refnumber = $_POST['refnumber'];
    $Resnumber = $_POST['resnumber'];
    $price = $db2->query("SELECT `price` FROM `user_payments`  WHERE `invoice_number` = '$Resnumber'");

    $client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl');       
    $res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber ));
    $Status = $res->verifyPaymentResult->ResultStatus;
    $PayPrice = $res->verifyPaymentResult->PayementedPrice;

    $db2->query("UPDATE `user_payments` SET `done` = '1' , `refid` = '$Refnumber' WHERE `invoice_number` = '$Resnumber'");
    $new_balance = $this->user->info->balance + $PayPrice;
    $uid = $this->user->info->id;
    $fee = $PayPrice;
    $time = time();
    $db2->query("UPDATE `users` SET `balance` = '$new_balance' WHERE `id` = '$uid' ");
    $db2->query("INSERT INTO `user_balance_report` (`uid`,`type`,`fee`,`msg`,`date`)VALUES('$uid','3','+".$fee."','your code: ".$Resnumber."','$time')");
    $D->user_purchase = "success <br>cost $fee Added in your account.";
    $this->user->sess['LOGGED_USER'] = $this->network->get_user_by_id($this->user->id, TRUE);
    $this->user->info = & $this->user->sess['LOGGED_USER'];
    }

但是从银行回来后我看到了这段代码: 可捕获的致命错误:类mysqli_result的对象无法在此行中转换为字符串:

        $res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber ));

1 个答案:

答案 0 :(得分:0)

我应该用

$price = $db2->fetch_field("SELECT `price` FROM `user_payments`  WHERE `invoice_number` = '$Resnumber'");