Forum Moderators: coopster & phranque

Message Too Old, No Replies

Error in SQL syntax

         

globay

10:15 pm on Mar 5, 2003 (gmt 0)

10+ Year Member



You have an error in your SQL syntax near ''Text goes here' at line 1

Somehow I get this error after trying to edit an inserted text from the mySQL Database. Does anybody know a solution? This is very important to me.

--
globay

jatar_k

10:17 pm on Mar 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what does the actual query string look like? Have you tried echo'ing the update query to see if it looks right?

Sounds like there are no quotes around a string possibly.

globay

10:22 pm on Mar 5, 2003 (gmt 0)

10+ Year Member



I inserted the text using PHPMyAdmin.

SELECT * FROM `infos` WHERE `ID1` = '1' AND `ID2` = '10' AND `ID3` = '0' AND `Titel` = 'Grundlagen' AND `Code` = 'Text goes here

MySQL meldet:

You have an error in your SQL syntax near ''Part of the text goes here' at line 1

It seems like there is no ' at the end. Is this a PHPMyAdmin Bug (I tried this with two different versions)?

Thanks

--
globay

jatar_k

10:38 pm on Mar 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You're right, it's missing the trailing quote. I don't use phpmyadmin very often but I've never had it mess up like that. Try putting the extra quote in the text and see what it does with it.

globay

10:38 pm on Mar 5, 2003 (gmt 0)

10+ Year Member



I just did some further testing: could it be that there is too much content saved in one cell? I created for testing purposes a longtext cell with 10,000+ characters and it does not seem to work either. I don't even get to the error message.

--
globay

jatar_k

10:42 pm on Mar 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



doesn't it have a code window where you can paste queries?

try this

SELECT * FROM infos WHERE ID1=1 AND ID2=10 AND ID3=0 AND Titel='Grundlagen' AND Code='Text goes here'

that is assuming ID1,ID2,ID3 are int's and all field/table names are correct

globay

10:59 pm on Mar 5, 2003 (gmt 0)

10+ Year Member



Thanks jatar_k for your help. It really is a very strange error:

As you suggested I just added the missing ' (And the text that was cut off) at the end and everything seemed to be alright, after entering it into the SQL Form.

Then I created a new entry, exactly the same as I did before, but instead of inserting the full amount of text (~1200 Characters) I just inserted the half. Everything seemed to be allright. Then I had PHPMyAdmin list me all entries and I clicked on "Edit" to edit the new entry. Well nothing happend. So I chose "Right Click" Open in New Window and I was able to edit the text. -> Basically everthing worked out as it should (except for having to open it in a new window).

Then I copied the text from the example above (~600 Characters) and inserted it again thus having ~1200 Characters. Everything seemed to be allright. Then I tried to edit this entry, and after opening it in the new window, part of the text was missing, as well as the ' sign at the end. Thats were I got the same error as stated in msg. 1 .

Then I created a new entry with just spaces and a (a a a...) (~10,000 Characters). Now I was not able to edit it nor open the edit window in a new window.

PHPMyAdmin really makes me crazy.

--
globay

jatar_k

11:10 pm on Mar 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it sounds like there might be a funky character in there. Have you looked carefully at where it is cutting off? There could be a common char or symbol, just a thought.