Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: edi67 on September 09, 2008, 07:28:55 AM

Title: Error importing data in DB
Post by: edi67 on September 09, 2008, 07:28:55 AM
One question, i trying to import one line of data in one my table ( personal_message) well going on SQL windo in my DB and launching the line:

INSERT INTO `personal_messages` (`id_pm`, `id_pm_head`, `id_member_from`, `deleted_by_sender`, `from_name`, `msgtime`, `subject`, `body`) VALUES
(2450, 2450, 158, 1, 'ciccio69', 1220896345, 'BEIJING 2008 OLYMPICS GAME - Informazioni sul prod', 'Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?'),


Return me back this error:
QuoteError

query SQL:

INSERT INTO `personal_messages` ( `id_pm` , `id_pm_head` , `id_member_from` , `deleted_by_sender` , `from_name` , `msgtime` , `subject` , `body` )
VALUES ( 2450, 2450, 158, 1, 'ciccio69', 1220896345, 'BEIJING 2008 OLYMPICS GAME - Informazioni sul prod', 'Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?' ) ,

Messaggio di MySQL: Documentazione
#1064 - 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 '' at line 2

why this error? line that i awant insert i took directly esporting from DB 5 minutes before to add, i wanted only try to see if import/export work, but i cannot understand where is the mistake

some solution?
Title: Re: Error importing data in DB
Post by: Oldiesmann on September 11, 2008, 08:52:35 PM
Try getting rid of the ` marks around the table names - sometimes that can cause the error you're getting.
Title: Re: Error importing data in DB
Post by: edi67 on September 12, 2008, 04:14:57 AM
Quote from: Oldiesmann on September 11, 2008, 08:52:35 PM
Try getting rid of the ` marks around the table names - sometimes that can cause the error you're getting.

I trying in this way:
INSERT INTO personal_messages ( id_pm , id_pm_head , id_member_from , deleted_by_sender , from_name , msgtime , subject , body )
VALUES ( 2450, 2450, 158, 1, 'ciccio69', 1220896345, 'BEIJING 2008 OLYMPICS GAME - Informazioni sul prod', 'Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?' ) ,


but i have the same error :( very strange.... some more solution?

that line i took directly from backup, i cannot understand this my DB save in that way but cannot resotre using same data?
Title: Re: Error importing data in DB
Post by: Rumbaar on October 02, 2008, 11:42:47 PM
Try using double quotes instead of single quotes.
INSERT INTO personal_messages ( id_pm , id_pm_head , id_member_from , deleted_by_sender , from_name , msgtime , subject , body )
VALUES ( 2450, 2450, 158, 1, "ciccio69", 1220896345, "BEIJING 2008 OLYMPICS GAME - Informazioni sul prod", "Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?" ) ,
Title: Re: Error importing data in DB
Post by: edi67 on October 03, 2008, 04:53:04 AM
Quote from: Rumbaar on October 02, 2008, 11:42:47 PM
Try using double quotes instead of single quotes.
INSERT INTO personal_messages ( id_pm , id_pm_head , id_member_from , deleted_by_sender , from_name , msgtime , subject , body )
VALUES ( 2450, 2450, 158, 1, "ciccio69", 1220896345, "BEIJING 2008 OLYMPICS GAME - Informazioni sul prod", "Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?" ) ,


Donw but... same error :(
Errore

query SQL:

INSERT INTO personal_messages( id_pm, id_pm_head, id_member_from, deleted_by_sender, from_name, msgtime, subject, body )
VALUES ( 2450, 2450, 158, 1, "ciccio69", 1220896345, "BEIJING 2008 OLYMPICS GAME - Informazioni sul prod", "Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?" ) ,

Messaggio di MySQL: Documentazione
#1064 - 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 '' at line 2
Title: Re: Error importing data in DB
Post by: Rumbaar on October 03, 2008, 08:53:15 AM
Ah it's the comma after the closing bracket.

Try:
INSERT INTO personal_messages ( id_pm , id_pm_head , id_member_from , deleted_by_sender , from_name , msgtime , subject , body )
VALUES ( 2450, 2450, 158, 1, "ciccio69", 1220896345, "BEIJING 2008 OLYMPICS GAME - Informazioni sul prod", "Ciao edi volevo delle informazioni in più.<br />Grazie<br />Possibile in megaupload?" )

Note you're missing the db prefix as well to the personal_messages table.
Title: Re: Error importing data in DB
Post by: edi67 on October 04, 2008, 10:27:09 AM
Quote from: Rumbaar on October 03, 2008, 08:53:15 AM
Ah it's the comma after the closing bracket.

Oh my god that was the problem...... leaving the bracket everything is ok...
Thx and sorry for this my silly mistake

Thx very much for your help guys.