我在浏览器中得到的值低于&我在数据库中保存了 AWBNoSeries 的值。...
ReturnMessage”:“ AWBNoSeries”:[“ 1234”,“ 5678”,
现在,我需要在mysql表 ecomexpress_awb 和列[ awb_type &状态]中保存其他2列值。我尝试下面的代码,我没有收到任何错误,但其他2列值将不会保存在数据库中。...
<?php
$mysqli = mysqli_connect("localhost","root","","do_management4");
$parsedData = json_decode($curl_response, true);
$stmt = $mysqli->prepare("INSERT INTO ecomexpress_awb(awb,awb_type,status) VALUES (?,?,?)");
$cod="COD";
$status="unused";
//loop through values and insert each one into the db
foreach ($parsedData['AWBNoSeries'] as $awb){
$stmt->bind_param("iii", $awb , $cod, $status);
$stmt->execute();
}
$stmt->close();
mysqli_close($mysqli);
?>
答案 0 :(得分:1)
在绑定中,您说的是所有值都是整数("iii"
)...
$stmt->bind_param("iii", $awb , $cod, $status);
我假设你想要字符串。...
$stmt->bind_param("iss", $awb , $cod, $status);