już zanlazłem bląd ale teraz wyskakuje mi coś takiego : "niepoprawne zapytanie: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = '9'' at line 6"
dodawanie mam bląd składni:/ błąd znajduje sie 31 linijce tego skryptu, nie wiem co jest grane bo powinno być ok
<?
$error = '';
switch ($_GET['action']) {
case "edit";
switch ($_GET['type']){
case "tele";
$imie = trim($_POST['imie']); $error .= "PROSZE+WPISAC+IMIE";
}
if (empty($_POST['nazwisko'])) { $error .= "WYBIERZ+NAZWISKO";
}
if (empty($_POST['email'])) { $error .= "WYBIERZ+EMAIL";
}
if (empty($_POST['telefon'])) { $error .= "PODAJ+TELEFON";
}
$sql = "UPDATE tabela SET
imie = '" . $_POST['imie'] . "' ,
nazwisko = '" . $_POST['nazwisko'] . "' ,
email = '" . $_POST['email'] . "' ,
telefon = '" . $_POST['telefon'] . "' ,
WHERE id = '" . $_GET['id'] . "' ";
} else {
header("location:index.php?action=edit&error=" . $error . "&id=" . $_GET['id'] );
}
break;
}
break;
case "add";
switch ($_GET['type']) {
case "tele";
$imie = trim($_POST['imie']); $error .= "PROSZE+WPISAC+IMIE";
}
if (empty($_POST['nazwisko'])) { $error .= "WYBIERZ+NAZWISKO";
}
if (empty($_POST['email'])) { $error .= "WYBIERZ+EMAIL";
}
if (empty($_POST['telefon'])) { $error .= "PODAJ+NUMER+TELEFONU";
}
$sql = "INSERT INTO tabela
(imie,
nazwisko,
email,
telefon)
VALUES
('" . $_POST['imie'] . "',
'" . $_POST['nazwisko'] . "',
'" . $_POST['email'] . "',
'" . $_POST['telefon'] . "')";
} else {
header("location:index.php?action=add&error=" . $error); }
break;
}
break;
}
?>
<p align="center" style="color:#FF0000">
Wykonane. <a href="lista.php">lista</a></p>
<?
}
?>