sql foreach problem
-
I use the following code:
global $wpdb; $ot = $_GET["ot"]; $query = "SELECT ort, wahlberechtigte, ungueltige, gueltige, CDU, SPD, UWG, Gruene, FDP, otix FROM wp_kommunalwahl WHERE ortsteil='" . $ot . "' ORDER BY ortsteil, otix"; $result = $wpdb->get_results($query); $anz = $wpdb->num_rows; foreach ($result as $row) { $otix = intval($row->otix); $aort[$otix] = $row->ort; $awberechtigte[$otix] = intval($row->wahlberechtigte); $aungueltige[$otix] = intval($row->ungueltige); $agueltige[$otix] = intval($row->gueltige); $acdu[$otix] = intval($row->CDU); $aspd[$otix] = intval($row->SPD); $auwg[$otix] = intval($row->UWG); $agruene[$otix] = intval($row->Gruene); $afdp[$otix] = intval($row->FDP); }
The select query works fine. The data retrieved are okay. The problem: The foreach clause retrieves the data but doesn’t stop at the end of the list. It work until time limit. How to solve the problem??? If there is only one row it works!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘sql foreach problem’ is closed to new replies.