Hola a todos, tengo un problema con un insert en MySQLi. El caso es este:
Código MySQL:
Ver original$db
->query
('INSERT INTO `urls` (who, title, desc, url, `time`, type) VALUES (\''.$pid.
'\', \''.$yt
->getTitle
().
'\', \''.mysqli_clean
($yt
->getDescription
()).
'\', \''.mysqli_clean
($_POST
['attach']).
'\', \''.
time().
'\', \'2\')') or die
($db
->error
);
Resulta que no se inserta la descripción de los videos de youtube o enlaces normales, probé escapando los datos ingresados con mysqli_real_escape_string pero sigo con el error. Por ejemplo al inserta el siguiento video:
http://www.youtube.com/watch?v=eOTbm-NvLII
Devuelve el siguiente error:
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 'desc, url, `time`, type) VALUES ('37', 'Nach - Efectos Vocales', 'Music video by' at line 1
Esta es una captura de mis tablas:
También probé cambiando de longtext a text pero tampoco funciona.
mi función mysqli_clean:
Código PHP:
function mysqli_clean($string){
global $db;
if(get_magic_quotes_gpc()){
$string = stripslashes($string);
}
//$string = htmlspecialchars($string);
return $db->real_escape_string($string);
}
Aunque sin ella también larga error.
Gracias de antemano por sus respuestas.