In below code, I am trying to pass values dynamically for "OrderNo & AWB".
$sql="SELECT order_id , alternateno FROM do_order";
$con=mysqli_connect("localhost","root","","do_management");
if ($result=mysqli_query($con,$sql))
{
while ($row=mysqli_fetch_row($result))
{
$data =
array (
'OrderNo' => '$row[order_id]',
'ManifestDetails' =>
array (
'AWB' => '$row[alternateno]',
'PaymentStatus' => 'COD',
),
);
}
mysqli_free_result($result);
}
mysqli_close($con);
$url = "http://1234.1234.1234.1234";
$data = json_encode($data);
$curl = curl_init($url);
$curl_response = curl_exec($curl);
curl_close($curl);
echo $curl_response ."\n";
Every time when I call URL in a browser, its display below error message:
"ReturnMessage":"AWB no with same order id ($row[order_id]) already exists","AWBNo":"$row[alternateno]"
But if I give static values for OrderNo
(16445) & AWB
(16445), then it works fine:
"ReturnMessage":"successful","AWBNo":"16445"
So it seems I am not passing values properly, please guide me on this.