![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
13/01/2012, 08:41
|
![Avatar de Quentin_](http://static.forosdelweb.com/customavatars/avatar436587_3.gif) | | | Fecha de Ingreso: septiembre-2011
Mensajes: 32
Antigüedad: 13 años, 4 meses Puntos: 0 | |
Respuesta: problema al insertar dato en tabla mysql Hola,
si pongo una palabra con apostrofe como por ejemplo " l'hora " el error que me da es el siguiente:
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 'hora','','')' at line 1
si pongo un % como por jemplo: "rebajas 50%" el error que me da es:
Warning: sprintf() [function.sprintf]: Too few arguments in C:\xampp\htdocs\mipagina\insertar.php on line 11 Query was empty
si lo pongo sin ningun caracter raro como: "l hola rebajas 50" lo inserta perfectamente.
He probado con el tipo de campo: text, char y varchar y en los tres me da este mismo error
el codigo html:
<label>texto:</label>
<input type="text" name="texto">
el insert del php:
$texto=$_POST['texto'];
$insertSQL = "INSERT INTO mitabla (texto) VALUES ('$texto')"; |