からの結果を反復処理する機能は、しかし、私が問題に実行している、非常に簡単になります。このように思える:、基本的にPHP:別の関数と出力
function getValidCustomers() {
global $db;
$getCustomers = $db->GetAll("SELECT * from customers where CustomerActive='1' AND protected IS NULL or protected=0;");
foreach($getCustomers as $customer) {
echo $customer['CustomerID']."\n";
}
}
function updateValidCustomers() {
$customers = getValidCustomers();
for ($i = 0; $i < sizeof($customers); $i++) {
echo "DEBUG: $customers[$i]\n";
}
}
updateValidCustomers();
:ここ
コードです出力は今すぐ顧客IDのリスト(updateValidCustomers()
から)です。 updateValidCustomers()
からgetValidCustomers()
のデータを取得してループして、実際にデータベースを操作する別のクエリを実行できるようにしたいだけです。
アイデア?
function getValidCustomers() {
global $db;
$getCustomers = $db->GetAll("SELECT * from customers where CustomerActive='1' AND protected IS NULL or protected=0;");
foreach($getCustomers as $customer) {
echo $customer['CustomerID']."\n";
}
return $getCustomers;
}
**一息**そう、近い。あなたは正しいです(他の人と一緒に)。私はもともと 'return $ customer ['CustomerID'];'を追加し、 'echo $ customer ['CustomerID']。\ n"; 'を置き換えましたが、それは基本的には一致した後に終了し、私の問題。先端の人に感謝します! – drewrockshard