ciao a tutti,
sto facendo una funzione per aggiornare una tabella
Codice PHP:
function testi_prodotti($connessione,$id,$titolo,$testo,$tabella,$action,$location){
switch ($action) {
case "update":
// Codice per aggiornare
$sql = "UPDATE $tabella SET prodotto = '$titolo', descrizione = '$testo' WHERE id = '$id'";
if(mysql_query($sql, $connessione) or die(mysql_error())) {
header("Location: ".$location);
}
break;
}
}
if($_POST['action'] == "update") {
$location = "catalogo.php";
if (isset($_SERVER['QUERY_STRING'])) {
$location .= (strpos($location, '?')) ? "&" : "?";
$location .= $_SERVER['QUERY_STRING'];
testi_prodotti($connessione,$_POST['id'],$_POST['titolo'],$_POST['testo'],$_POST['tabella'],$_POST['action'],$location);
}
}
ma quando provo a passargli i dati mi viene fuori questo errore
codice:
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 '' at line 1
ma non capisco dov'è l'errore di sintassi.... :master:
Grazie mille