Введение в программирование на PHP5


Example.I.16


'—Создание записи OrderDetail

$sqlDetail ="SELECT * FROM OrderDetail WHERE NULL";

$rsDetail = odbc_exec($conn,$sqlDetail);

$sqlShopCart ="SELECT * FROM ShopCart WHERE OrderNo ='$OrderNo'";

$rsShopCart = odbc_exec($conn,$sqlShopCart);

while ($row = odbc_fetch_array($rsShopCart))

{

$sqlProd ="SELECT ItemTitle,ItemPrice FROM Products WHERE ItemNumber ='$row[OrderItem]'";

$rsProd = odbc_exec($conn,$sqlProd);

$ProdTitle = odbc_result($rsProd,ItemTitle);

$ProdPrice = odbc_result($rsProd,ItemPrice);

$sqlInsertDetail = "INSERT INTO OrderDetail (OrderNo,ItemNumber,ItemQuantity,ItemTitle,ItemPrice) Values ('$row[OrderNo]','$row[OrderItem]','$row[OrderQuantity]','$ProdTitle','$ProdPrice')";

$rsInsertDetail = odbc_exec($conn,$sqlInsertDetail);

}




Начало  Назад  Вперед



Книжный магазин