可以任何人愿意将MySql_ *转换为MySqli吗?

时间:2013-12-31 05:27:15

标签: php mysql database mysqli

我一直在尝试将MySQL_转换为MySQLi时遇到问题,因此有可能有人愿意通过转换此SQL查询来帮助我吗?

 $sql="INSERT INTO  `paypal_mysqltable_name` (datenow,    item_name,   item_number,      payment_status,    payment_amount,   payment_currency,  payer_email,     payment_type,   custom, 
invoice, first_name, last_name, address_name, address_country, address_country_code, address_zip, address_state, address_city, address_street) 
            VALUES (CURRENT_TIMESTAMP,'item_name','$item_number','$payment_status', '$payment_amount','$payment_currency','$payer_email', '$payment_type','$custom' ,'$invoice','$first_name','$last_name','$address_name','$address_country','$address_country_code','$address_zip','$address_state','$address_city','$address_street')";

例如:对于这样的声明?

$stmt = $mysqli->prepare("

1 个答案:

答案 0 :(得分:-1)

看起来像这样:

$stmt = $mysqli->prepare("INSERT INTO  `paypal_mysqltable_name` (datenow,    item_name,   item_number,      payment_status,    payment_amount,   payment_currency,  payer_email,     payment_type,   custom, 
invoice, first_name, last_name, address_name, address_country, address_country_code, address_zip, address_state, address_city, address_street) 
            VALUES (CURRENT_TIMESTAMP,'item_name', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->execute(array(
    $item_number,
    $payment_status,
    $payment_amount,
    $payment_currency,
    $payer_email,
    $payment_type,
    $custom,
    $invoice,
    $first_name,
    $last_name,
    $address_name,
    $address_country,
    $address_country_code,
    $address_zip,
    $address_state,
    $address_city,
    $address_street
));