Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

mysql resultset in mehrdimensionales array

Empfohlene Antworten

Veröffentlicht

hallo @all,

ich möchte Datensätze aus MySQL in ein mehrdimensionales Array füllen und anschließend nach Spalten sortieren können.


while ($myrow = mysql_fetch_array($res)) {
$data = array('tanr'=>$myrow["TaNr"],'date'=>$myrow["Datum"],'creator'=>$myrow["ersteller"]);

foreach ($data as $key => $value) {
//echo "Schlüssel: $key; Wert: $value<br>\n";
$var = "array("."'".$key."'"."=>".$value."), ";

}
$anz=array_push ($data, $var);

} // Ende While

foreach($data as $key=> $value){
for($i=0; $i<= count($data); $i++){
echo "<tr><td>".$data[$i]."</td></tr>";
}
}

[/php]

Funzt leider nich so wie ich mir das vorstelle. Hat jemand ne Idee? Die Ausgabe gibt mir nur den letzten Datenwert aus (creator), ich hätte aber ganz gern alle :floet:

Wie wäre es, ein temporäres Array zu erstellen und dann über array_push() die Werte, die für einen Eintrag wichtig sind in das temporäre Array zu packen. Am Ende packst du dann das ganze temp. Array wiederum per array_push in ein Array. So hast du auch ein mehrdim. Array erzeugt.

warum nicht schon im SQL sortieren?

Ach, hat sich offensichtlich schon erledigt. Die Frage war von ner Kollegin, die zuviel Angst vor euch hatte ;)

Hats aber offensichtlich hingekriegt, weilse (ausnahmsweise) nich gemeckert hat *schnell versteck* :floet: :hells:

Thanks anyway :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.