Scusa è che l'errore è sempre lo stesso, te lo posto
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 's &PHPSESSID=96ofhosoukfudspt3dlf7g0dn3')' at line 1
Ho scritto pippo's e il ritorno è questo.
Mi sa che renderei tutto più semplice se postassi l'intero codice della mia pagina...
Codice PHP:
if (isset($_POST['testo'])) {
$oggi = date("l, j F Y");
$testo = $_POST['testo'];
$testo_con_escape = mysql_real_escape_string($testo);
$focus = $_POST['focus'];
if (is_uploaded_file($_FILES["img"]["tmp_name"])){
$img = "allegati/" . $_FILES["img"]["name"];
move_uploaded_file($_FILES["img"]["tmp_name"], $img);
chmod ($img, 0777);
}
if ($_POST["focus"]==""){
$sql = "INSERT INTO news (nw_titolo, nw_testo, nw_img, nw_stato, nw_data) values ('" . str_replace("'","'\ ",$_POST['titolo']) . "', '$testo_con_escape', '$img', 1,CURDATE())";
} else {
$sql = "INSERT INTO news (nw_focus,nw_titolo, nw_testo, nw_img, nw_stato, nw_data) values ('" . $_POST["focus"] . "','" . $_POST["titolo"] . "', '$testo_con_escape', '$img', 2,CURDATE())";
}
if (mysql_query($sql)){
echo '<table align=\"center\"><tr><td class="testo_b_12"> News inserita correttamente</td></tr>';
echo "<tr><td><a href=\"gestione_news.php?". session_name() . "=" . session_id() ."\"><font color=\"#000000\">prosegui</font></a></td></tr></table>";
} else {
echo '
Errore news non inserita!!!' . mysql_error() . '
';
}
}
?>