cll
Ich sende an eine Datei eine Tabelle und Pärchen von Variablen namens spalte1 / wert1, spalte2 / wert2 usw und möchte die Werte eintragen. Ich kriegs bloß nicht hin die Werte richtig abzurufen. Mein Code:
$sql = "UPDATE $table SET";
for($i=1; $i<5; $i++){
$sql .= "$_POST[spalte$i] = $_POST[wert$i]";
echo "<br>$_POST[spalte$i] = $_POST[wert$i]";
}
$sql .= "WHERE id='".$uid."'";
Die Fehlermeldung:
Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in /var/www/web46/web/changedata.php on line 11
(bezieht sich auf $_POST[spalte$i] )
Ich hab auch schon $_POST[spalte[$i]] versucht, das ging auch nicht...
$sql = "UPDATE $table SET";
for($i=1; $i<5; $i++){
$sql .= "$_POST[spalte$i] = $_POST[wert$i]";
echo "<br>$_POST[spalte$i] = $_POST[wert$i]";
}
$sql .= "WHERE id='".$uid."'";
Die Fehlermeldung:
Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in /var/www/web46/web/changedata.php on line 11
(bezieht sich auf $_POST[spalte$i] )
Ich hab auch schon $_POST[spalte[$i]] versucht, das ging auch nicht...
Sorry, ich stand aufm Schlauch. Danke!