Hallo Leute,
ich kapiers einfach nicht - und wahrscheinlich ist es ganz einfach...
Ich versuche via while Datensätze aus der Datenbank zu lesen. Wunderbar - nur lässt er den ersten Datensatz aus.
$ptypes=array("standartpersonal", "fremdpersonal", "zusatzpersonal");
$p=array();
for($i=0; $i<count($ptypes); $i++) {
$mysql_query="SELECT * FROM produktionpersonal WHERE id_produktion = ".$_SESSION["m"]["produktion"]["id_produktion"]." AND typ = '".$ptypes[$i]."'";
$mysql_ressource = mysql_query($mysql_query) or die(mysql_error());
$data_result = mysql_fetch_array($mysql_ressource, MYSQL_ASSOC);
if($data_result["id_produktionpersonal"]) {
$p[$ptypes[$i]]=array();
$data=array();
while ($data_result = mysql_fetch_array($mysql_ressource, MYSQL_ASSOC)) {
$data=array();
$data["ppid"]=$data_result["id_preisgruppepersonal"];
$data["name_text"]=getFieldById("personal",
$data_result["id_personal"], "vorname")." ".getFieldById("personal", $data_result["id_personal"], "name");
$data["name_id"]=$data_result["id_personal"];
$data["preis"]=$data_result["preis"];
echo implode($data)."<br>";
array_push($p[$ptypes[$i]], $data);
} // while
}//if
} // for i
Die Datenbank sieht so aus:
-- Tabellenstruktur für Tabelle
produktionpersonal
--
CREATE TABLE
produktionpersonal
(id\_produktionpersonal
int(11) NOT NULL auto_increment,timestamp
int(11) NOT NULL,id\_personal
int(11) NOT NULL,id\_preisgruppepersonal
int(11) NOT NULL,id\_produktion
int(11) NOT NULL,typ
text collate latin1_general_ci NOT NULL,preis
text collate latin1_general_ci NOT NULL,id\_editor
int(11) NOT NULL,PRIMARY KEY (
id\_produktionpersonal
)) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=6 ;
--
-- Daten für Tabelle
produktionpersonal
--
INSERT INTO
produktionpersonal
VALUES (1, 1162200563, 6, 1, 487, 'standartpersonal', '1.250,00', 0);INSERT INTO
produktionpersonal
VALUES (2, 1162200563, 5, 2, 487, 'standartpersonal', '300,18', 0);INSERT INTO
produktionpersonal
VALUES (3, 1162200563, 4, 7, 487, 'standartpersonal', '300,00', 0);INSERT INTO
produktionpersonal
VALUES (4, 1162200563, 2, 5, 487, 'standartpersonal', '1.100,37', 0);INSERT INTO
produktionpersonal
VALUES (5, 1162200563, 9, 5, 487, 'standartpersonal', '1.100,37', 0);Tjoa. Ich bin restlos überfragt. Bzw. erhalte ich nach dieser Abfrage einfach nicht den ersten Datensatz.
Wer weiß weiter?
Matthias