Hi Guys,

Not sure if this is a php or sql problem but i keep getting the following error when trying to update a row using php and 'UPDATE':

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...

I've done a bit of testing on it and when i remove 'description' from the update it works fine.
My 'description' field is 2000 in length so i'm assuming it's too big to handle.
Any suggestions welcome.



Recommended Answers

All 5 Replies

you should have to use LONGBLOB datatype for your description.

This will help you in update query. and you don't have to define any length in LONGBLOB datatype,

it will work fine and display your description with normal fetch method.

Thanks Jogesh,

Will give it a go as soon as i get home.

Hi again,

How would i go about saving the update info to a longblob/longtext i.e. what is the syntax.
I've looked for examples without success.
Does it matter that some of the fields are set as varchar in the database?



hi Tom, here is an example for LONGBLOB with syntax

CREATE TABLE `test`.`check` (
`description` LONGBLOB NOT NULL
) ENGINE = InnoDB;

these syntax for LONGTEXT

CREATE TABLE `test`.`check` (
`description` LONGTEXT NOT NULL
) ENGINE = InnoDB;

actually the length of VARCHAR is 0 to 255, it will not display more than 255, and it doesn't matter that other fields are set VARCHAR, cause the database contain any datatype in mean time, like ID as INT, NAME as VARCHAR, and DISCRIPTION as LONGBLOB but the difference is if you want to see the value direct in phpmyadmin the you will not see that LONGBLOB value, just see its size in bytes and i don't think so its a huge matter to see in phpmyadmin.

hopefully it help you to understand :)

take care

Thanks for the detailing there Jogesh.
I was working on it last night and something didn't seem quite right and then i realised i'd been using reserved names for my column names more specifically 'desc'....duh.

Thanks for the explaination about blobs though my resulting investigation has gained me alot of knowledge about them


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.