Ok .. ich versteh schon wieder mal nur Bahnhof.
Ich hab folgenden Code:
Code
$result = $wpdb->get_results( 'SELECT * FROM '.REGIMENTTABLE.' WHERE ArmyId = '.$_GET['truppe'].' ORDER BY RegimentName DESC', ARRAY_A );
foreach ($result as $line) {
$attribute = array($line['Attributes']);
print_r($attribute);
}
Das Datenbankfeld 'Attributes' enthält folgenden Text: 'AttackDice => "3", DefenseDice => "3", Strength => "2", ...'
Ich hab gedacht, ich kann mit array() diesen Inhalt in ein assoziatives Array umwandeln. Aber denkste!
Wordpress spuckt mir bei print_r($attribute); folgendes aus:
Array ( [0] => AttackDice => "3", DefenseDice => "3", Strength => "2", ... )
jetzt frag ich mich: wo kommt das [0] => her, das mir mein ganzes Array kaputt macht?!
Hat das mit dem foreach zu tun, weil das auch schon ein Array erzeugt? Und wenn ja, wie kann ich mein Problem lösen?