我试图回显meekrodb结果集返回的值。
这是一个脚本,该脚本删除表中的值,然后从库存表中重新填充它们。
<?php
require 'functions.php';
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$message='';
$products = array();
$store_id = 1;
$sub_location_id = 6;
$team_id = 2;
$user_id = 1;
$deleteQry = DB::query("DELETE FROM warehouse_physical_countings WHERE ((sub_location_id = '$sub_location_id' )AND (team_id = '$team_id'))");
if($deleteQry) {
echo "Deleting all records on sub location $sub_location_id ";
$sql = "SELECT
`inventory`.`item_no`
, `items_qty`.`qty`
FROM
`pos`.`inventory`
INNER JOIN `pos`.`items_qty`
ON (`inventory`.`item_no` = `items_qty`.`items_id`)
WHERE (`items_qty`.`stores_id` = '$store_id'
AND `inventory`.`active` = 1) ORDER BY `inventory`.`item_no`;";
$res = DB::query($sql);
foreach($res as $row) {
$insertQry = DB::InsertUpdate( 'warehouse_physical_countings', array(
'items_id' => $row['item_no']
,'user_id' => $user_id
, 'team_id' => $team_id
, 'sub_location_id' => $sub_location_id
, 'counted_on' => getDateTime(0 , "mySQL")
, 'qty_counted' => $row['qty']
));
echo "<p> $row['item_no'] </p>";
}
echo "<h1> Adding POS stock to Team: $team_id with user_id: $user_id</h1>";
}
echo "<h1> Completed Data Copying.</h1>";
页面变为空白,错误日志显示:
PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/home/export_rakport_stock_to_team2.php on line
41