ich versuche auf die folgendenForeach-Schleife verschachtelt 3 mal plagt
Schleife für jede Dachmessung (fastbid_inspection_measurement_roof
) row
Foreach Reihe greift roof_pitch Dann dann eine foreach-Schleife tun Abfrage
fastbid_labor_tearoff
wo pitch
ist identisch mit
dann das Ergebnis dieser Zeile Übereinstimmung in fastbid_labor_tearoff
und berechnen Sie die Kosten.
AUGENBLICK
Wenn es einen Datensatz es perfekt funktioniert, aber wenn zwei Datensätze dort innerhalb fastbid_inspection_meaasurement_roof
ist, dann wird es zwei Ergebnisse Echo. Ich möchte, dass es ein SUMME GESAMT von beiden oder ALLE Aufzeichnungen widergibt.
Wohin gehe ich falsch?
fastbid_inspection_measurement_roof Schema
-------------------------------
| id | roof deck | roof_pitch |
-------------------------------
| 01 | 1359 | 5 |
-------------------------------
| 02 | 1211 | 6 |
-------------------------------
fastbid_labor_tearoff Schema
---------------------------------------------
| id | labor_cost | ground_drop | pitch |
---------------------------------------------
| 01 | 22.50 | 7 | 5 |
---------------------------------------------
| 02 | 23.50 | 7 | 6 |
---------------------------------------------
Hier ist meine Foreach Loops
$RoofDecksssss = "SELECT * FROM fastbid_inspection_measurement_roof WHERE Prospect_API = '".$prosapi."'";
foreach ($pdo->query($RoofDecksssss) as $RoofDeck) {
foreach ($RoofPitch as $Pitch) {
$TearOff_Labor_PerPitch = "SELECT * FROM fastbid_labor_tearoff WHERE pitch = '".$Pitch['roof_pitch']."'";
foreach ($pdo->query($TearOff_Labor_PerPitch) as $TearOffCost) {
$LaborCost = $TearOffCost['labor_cost'];
$RoofDeckSQFT = $RoofDeck['roof_deck'];
$GroundDropCost = $TearOffCost['ground_drop'] * DeckSqFT_toRawSquare($RoofDeckSQFT);
$Total_Labor += $LaborCost * DeckSqFT_toRawSquare($RoofDeckSQFT);
$TotalLaborTearOffCost = $GroundDropCost + $Total_Labor;
echo $TotalLaborTearOffCost;
}
}
}
Das ist richtig, ich habe eins herausgeholt und es funktioniert. Jetzt bekomme ich eine Fehlermeldung "PHP Warnung: Ungültiger String Offset 'roof_pitch'" – Kray