Ver Mensaje Individual
  #13 (permalink)  
Antiguo 13/01/2010, 16:56
okawa
 
Fecha de Ingreso: mayo-2009
Mensajes: 69
Antigüedad: 15 años
Puntos: 0
Respuesta: Leer/Insertar comillas campo mysql

Cita:
Iniciado por pateketrueke Ver Mensaje
bien, entonces intenta usar htmlspecialchars() sobre tus variables antes de insertarlas en la BD
Me lanza el siguiente codigo:

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 'Anellament Marjal del Moro', 'Blog de este grupo de anillamiento en el que se va' at line 1

Recogida de datos

Código PHP:
$titulo_enlace=$_REQUEST['titulo_enlace'];
$texto_enlace=$_REQUEST['texto_enlace'];
$titulo_enlace=htmlspecialchars($titulo_enlace);
$texto_enlace=htmlspecialchars($texto_enlace);
$archivo=$_FILES["archivo"]['name'];
$prefijo=substr(md5(uniqid(rand())),0,6);
$destino="../imagenes/".$prefijo."_".$archivo
INSERTAMOS EN LA BD

Código PHP:
$insertar=mysql_query("INSERT INTO enlaces (titulo_enlace, texto_enlace, img_enlace) VALUES ('$titulo_enlace', '$texto_enlace', '$destino')",$db) or die(mysql_error());