Ho dato un'occhiata al link che mi avete dato.
E ho preso giù quella funziona di esempio:
Codice PHP:
// Quote variable to make safe
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}
e nella query
Codice PHP:
mysql_query("insert into archivio (data, quotidiano, titolo, pdfPath, fileSize, category) values (quote_smart('$data'), quote_smart('$quotidiano'), quote_smart('$titolo'), quote_smart('$pathFileServer'), quote_smart('$fileSize'), quote_smart('$category'));", $conn) or die ("Non è possibile eseguire la query sul database. Contattare l'amministratore del database".mysql_error());
Poi ho provato a passare come variabile di testo
quotidiano:
per vedere come si comportava con la virgoletta.
Questo è il messaggio di errore:
MySQL server version for the right syntax to use near '('2005-04-16'), quote_smart('test security fall ''), quote_smar
Come posso risolverlo?
Grazie gente