Foros del Web » Programando para Internet » Jquery »

Error 1064 de SQL

Estas en el tema de Error 1064 de SQL en el foro de Jquery en Foros del Web. Hola amigos soy nuevo y queria saber que sucede a mi archivo, soy novato en esto de las tablas solo se agregarlas a la base ...
  #1 (permalink)  
Antiguo 29/05/2015, 14:18
 
Fecha de Ingreso: mayo-2015
Mensajes: 2
Antigüedad: 8 años, 10 meses
Puntos: 0
Pregunta Error 1064 de SQL

Hola amigos soy nuevo y queria saber que sucede a mi archivo, soy novato en esto de las tablas solo se agregarlas a la base de datos, pero curiosamente me sucede que intento meter una aqui se las pongo:


CREATE TABLE IF NOT EXISTS `links` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`votes` tinyint(2) DEFAULT '0',
PRIMARY KEY (`id`)
)

INSERT INTO `links` (`id`, `title`, `description`, `votes`) VALUES
(1, 'Favorite Star Rating with jQuery', 'This tutorial is for doing favorite star rating using jQuery. It displays list of HTML stars by using li tags. These stars are highlighted by using CSS and jQuery based on the favorite rating selected by the user.', 0),
(2, 'PHP RSS Feed Read and List', 'PHP''s simplexml_load_file() function is used for reading data from xml file. Using this function, we can parse RSS feed to get item object array.', 0),
(3, 'jQuery AJAX Autocomplete – Country Example', 'Autocomplete feature is used to provide auto suggestion for users while entering input. It suggests country names for the users based on the keyword they entered into the input field by using jQuery AJAX.', 0);




Cuando intento ponerla me dice un error el cual entendi es por estos signos ` ` intente sacarlos y cuando meto otra vez me dice el error 1064 es decir el mismo error si no es mucha molestia alguien que me diga que sucede alli


aqui el error miren:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO `links` (`id`, `title`, `description`, `votes`) VALUES (1, 'Favorit' at line 9
  #2 (permalink)  
Antiguo 29/05/2015, 14:49
Avatar de gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 4 meses
Puntos: 2658
Respuesta: Error 1064 de SQL

Este es un problema de MySQL, no de Jquery. Deberías haberlo posteado en el foro de MYSQL.

En primer lugar, espero que te quede claro que esto es una sentencia:

Código MySQL:
Ver original
  1. CREATE TABLE IF NOT EXISTS `links` (
  2. `title` varchar(255) NOT NULL,
  3. `description` text NOT NULL,
  4. `votes` tinyint(2) DEFAULT '0',
  5. )
y esto es otra sentencia separada:
Código MySQL:
Ver original
  1. INSERT INTO `links` (`id`, `title`, `description`, `votes`) VALUES
  2. (1, 'Favorite Star Rating with jQuery', 'This tutorial is for doing favorite star rating using jQuery. It displays list of HTML stars by using li tags. These stars are highlighted by using CSS and jQuery based on the favorite rating selected by the user.', 0),
  3. (2, 'PHP RSS Feed Read and List', 'PHP''s simplexml_load_file() function is used for reading data from xml file. Using this function, we can parse RSS feed to get item object array.', 0),
  4. (3, 'jQuery AJAX Autocomplete – Country Example', 'Autocomplete feature is used to provide auto suggestion for users while entering input. It suggests country names for the users based on the keyword they entered into the input field by using jQuery AJAX.', 0);
No puedes poner todo eso junto si no pones los separadores de sentencias (el punto y coma), que en el CREATE TABLE no está, con lo que si está todo en un mismo script, es como si intentases poner en una única query todo junto... no se ejecutará.

Fijate en ese punto y coma final:
Código MySQL:
Ver original
  1. CREATE TABLE IF NOT EXISTS `links` (
  2. `title` varchar(255) NOT NULL,
  3. `description` text NOT NULL,
  4. `votes` tinyint(2) DEFAULT '0',
  5. );
Acostumbrate a verificar por ti mismo los errores de sintaxis básicos, o bien instala el MySQL Workbench y usalo para probar las sentencias de MYSQL. Tiene un analizador sintáctico incorporado.
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)

Etiquetas: 1064, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:10.