PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Arrayblind


tlang78
30.06.2009, 10:36:58
Hallo ich habe ein Problem mit einem Array und komme seit 2 Tagen absolut nicht mehr weiter!

Ich hoffe ihr könnt mir helfen!

Hier wird das Array erstellt:


//Projekte auslesen
<?php $b=0; ?>
<?php while ($myrow_dat=mysql_fetch_array($query_dat)){

<input type="hidden" name="update[<?php echo $b;?>][update_id]" value="<?php echo $myrow_dat[STID]; ?>">
<td align="left"><input type="text" name="update[<?php echo $b;?>][update_baustein]" value="<?php echo $myrow_dat[STBaustein]; ?>" size="30"></td>
<td align="left"><input type="text" name="update[<?php echo $b;?>][update_honorarprozent]" value="<?php echo $myrow_dat[STHonorarProzent]; ?>" size="5"></td>

//Monate des Projektes auslesen
$sql_monate = "SELECT MID, MSTID, MMonat, MWert FROM monate WHERE MSTID = '$myrow_dat[STID]' ORDER BY MMonat";
$query_monate=mysql_query($sql_monate)or die( mysql_error());
$c=0;
while ($myrow_monate=mysql_fetch_array($query_monate)){
?><td align="left">
<input type="text" name="update_monat[<?php echo $c;?>][update_id]" value="<?php echo $myrow_dat[STID]; ?>" readonly>
<input type="text" name="update_monat[<?php echo $c;?>][monat]" value="<?php echo $c;?>" size="5" readonly>
<input type="text" name="update_monat[<?php echo $c;?>][monat_id]" value="<?php echo $myrow_monate[MID]; ?>" size="5" readonly>
<input type="text" name="update_monat[<?php echo $c;?>][monat_wert]" value="<?php echo $myrow_monate[MWert]; ?>" size="5">
<input type="checkbox" name="update_monat[<?php echo $c;?>][monat_fakturiert]" value="true" disabled></td><?php
$c++;
}

}


Das erste Array funktioniert einwandfrei. Auch das zerlegen. Das 2. mit den Monaten macht mir jedoch zu schaffen.

Das Array muss folgende Werte enthalten:
- ID des Projekts
- ID des Monats
- Wert des Monats
- Fakturiert

Ich hoffe der Ausschnitt reicht, wenn nicht kann ich auch die komplette Datei zur Verfügung stellen.

Gruß
Thomas

xlb
30.06.2009, 13:34:17
Hi.

Das 2. mit den Monaten macht mir jedoch zu schaffen.

Öhm ... - und was genau erregt deinen Missmut ?

Willst du die Query-Ergebnisse mit assoziativen oder numerischen Indizes ansprechen ? Ich vermute mal ersteres ...

Dann würden Double- oder Single-Quotes fehlen :

echo $myrow_dat['STID']

Läuft das Skript ansonsten fehrlefrei (-> error_reporting(E_ALL), mysql_error(), .... ) ?



Grüssken,
Axel

tlang78
30.06.2009, 16:08:33
Hi Axel,

Bahnhof, Abfahrt 7:30 Uhr :)

Mein Problem ist, dass das 2. Array mit den Monaten inkl. Werte absolut nicht hinhaut.

1. Schleife (Auslesen der Projekte) ($b = Vortlaufende Nr. je Projekt)
Array bauen:
update[<?php echo $b;?>][update_id]
update[<?php echo $b;?>][update_honorar]
update[<?php echo $b;?>][update_auftrag]

2. Schleife (Auslesen der Monate je Projekt) (Es sind proProjekt jeweils 16 Monate gespeichert) ($c = Vortlaufende Nr. je Monat)
Innerhalb dieser Schleife wird dann die Tabelle Monate abgefragt.

update_monat[<?php echo $c;?>][update_id]
update_monat[<?php echo $c;?>][update_monat]
update_monat[<?php echo $c;?>][update_wert]

Ergenis des 1. Arrays

Array ( [0] => Array ( [update_id] => 85 [update_baustein] => Test [update_honorarprozent] => 0.00 [update_honorarwert] => 1000 [update_potential] => 6000 [update_angebot] => 5000 [update_auftrag] => 5000 [update_verloren] => 1000 [update_fakturiert] => 3000 ) [1] => Array ( [update_id] => 86 [update_baustein] => Test2 [update_honorarprozent] => 0.00 [update_honorarwert] => 500 [update_potential] => 9600 [update_angebot] => 8000 [update_auftrag] => 8000 [update_verloren] => 1600 [update_fakturiert] => 4000 ) )

Ergebnis des 2. Arrays

Array ( [0] => Array ( [0] => Array ( [update_id] => 85 [monat] => 0 [monat_id] => 1577 [monat_wert] => 10 ) [1] => Array ( [update_id] => 85 [monat] => 1 [monat_id] => 1578 [monat_wert] => 0 ) [2] => Array ( [update_id] => 85 [monat] => 2 [monat_id] => 1579 [monat_wert] => 0 ) [3] => Array ( [update_id] => 85 [monat] => 3 [monat_id] => 1580 [monat_wert] => 0 ) [4] => Array ( [update_id] => 85 [monat] => 4 [monat_id] => 1581 [monat_wert] => 0 ) [5] => Array ( [update_id] => 85 [monat] => 5 [monat_id] => 1582 [monat_wert] => 0 ) [6] => Array ( [update_id] => 85 [monat] => 6 [monat_id] => 1583 [monat_wert] => 0 ) [7] => Array ( [update_id] => 85 [monat] => 7 [monat_id] => 1584 [monat_wert] => 0 ) [8] => Array ( [update_id] => 85 [monat] => 8 [monat_id] => 1585 [monat_wert] => 0 ) [9] => Array ( [update_id] => 85 [monat] => 9 [monat_id] => 1586 [monat_wert] => 0 ) [10] => Array ( [update_id] => 85 [monat] => 10 [monat_id] => 1587 [monat_wert] => 0 ) [11] => Array ( [update_id] => 85 [monat] => 11 [monat_id] => 1588 [monat_wert] => 0 ) [12] => Array ( [update_id] => 85 [monat] => 12 [monat_id] => 1589 [monat_wert] => 0 ) [13] => Array ( [update_id] => 85 [monat] => 13 [monat_id] => 1590 [monat_wert] => 0 ) [14] => Array ( [update_id] => 85 [monat] => 14 [monat_id] => 1591 [monat_wert] => 0 ) [15] => Array ( [update_id] => 85 [monat] => 15 [monat_id] => 1592 [monat_wert] => 0 ) ) [1] => Array ( [0] => Array ( [update_id] => 86 [monat] => 0 [monat_id] => 1593 [monat_wert] => 0 ) [1] => Array ( [update_id] => 86 [monat] => 1 [monat_id] => 1594 [monat_wert] => 0 ) [2] => Array ( [update_id] => 86 [monat] => 2 [monat_id] => 1595 [monat_wert] => 0 ) [3] => Array ( [update_id] => 86 [monat] => 3 [monat_id] => 1596 [monat_wert] => 0 ) [4] => Array ( [update_id] => 86 [monat] => 4 [monat_id] => 1597 [monat_wert] => 0 ) [5] => Array ( [update_id] => 86 [monat] => 5 [monat_id] => 1598 [monat_wert] => 0 ) [6] => Array ( [update_id] => 86 [monat] => 6 [monat_id] => 1599 [monat_wert] => 0 ) [7] => Array ( [update_id] => 86 [monat] => 7 [monat_id] => 1600 [monat_wert] => 0 ) [8] => Array ( [update_id] => 86 [monat] => 8 [monat_id] => 1601 [monat_wert] => 0 ) [9] => Array ( [update_id] => 86 [monat] => 9 [monat_id] => 1602 [monat_wert] => 0 ) [10] => Array ( [update_id] => 86 [monat] => 10 [monat_id] => 1603 [monat_wert] => 0 ) [11] => Array ( [update_id] => 86 [monat] => 11 [monat_id] => 1604 [monat_wert] => 0 ) [12] => Array ( [update_id] => 86 [monat] => 12 [monat_id] => 1605 [monat_wert] => 0 ) [13] => Array ( [update_id] => 86 [monat] => 13 [monat_id] => 1606 [monat_wert] => 0 ) [14] => Array ( [update_id] => 86 [monat] => 14 [monat_id] => 1607 [monat_wert] => 0 ) [15] => Array ( [update_id] => 86 [monat] => 15 [monat_id] => 1608 [monat_wert] => 0 ) ) )

Soweit ich seh ist alles drin, aber wie bekomm ich das Array jetzt wieder aufgedröselt. Oder geht das irgendwie besser? Ich blick einfach nicht mehr durch.