私はarray..Iの各値に対するクエリの最初と最後の値がこっちobvious..butを探しているかもしれませんどのように出力にPHPの例を探していますが、私が持っているものです。あなたがいるので、私は出力に含まが各$ firstsku、$ lastsku、location_idのだろうLOCATION_ID $の各値を取り、クエリクエリの最初と最後の結果を出力するPHP/MYSQl配列のforeach値?
$resultF = $conn->query("Select sku from inventory where location_id="$location_id" Order by sku ASC ");
while($row = $resultF->fetch_assoc()) {
$firstsku= $row['sku']; }
$resultL = $conn->query("Select sku from inventory where location_id="$id" Order by sku DSC ");
while($row = $resultL->fetch_assoc()) {
$lastsku= $row['sku'];}
を実行したいと思います
$userId = $_SESSION['userId'];
$sourceID = $_POST['sourceID'];
ProcessDate= $_POST['processDate'];
$result = $conn->query("SELECT location_id FROM inventory
where source_date = '$sourceID' and source_id = '$sourceID' and created_by= '$userId'");
while($row = $result->fetch_assoc()) {
$location_id[$x] = $row['location_id'];
$x++;
}
は
1つのクエリ(2つの選択肢を最大と最小の和集合で組み合わせる)を組み合わせないのはなぜですか? –
はい、ここで1 + 2nクエリがあります。代わりに1つしかないかもしれません。私は多分私が間違っ – Strawberry
eveytime userIdの後の余分な引用。再びありがとう – ForgivenIT