Jump to content

Recommended Posts

I have a form with a pretty simple PHP processor/verification page to add it to my database.  It usually works unless my text gets too long/complex.  After approximately 200 characters it no longer saves to the database.  I had it echo the value on the processing/submittal page and I can tell that it is getting the data properly.  Here is the code I have to write it into my database:

 

$result = mysql_query("INSERT INTO news (title, dtime, text1, text2)

VALUES ('$title',NOW(),'$text1','$text2')",$connect);

 

It is having problems with text2.  It was originally just TEXT but I tried changing it to LONGTEXT without results.  Any help would be greatly appreciated.

 

EDIT: When it rejects the entry it does not report any errors.

Link to comment
https://forums.phpfreaks.com/topic/185800-form-inconsistently-submits-data/
Share on other sites

echo .mysql_error(); 

 

I just tried again with much longer text and got this 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

 

It does not report that unless there is a rather large amount of text entered.  My server is using MySQL 5.0.32

echo .mysql_error(); 

 

I just tried again with much longer text and got this 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

 

It does not report that unless there is a rather large amount of text entered.  My server is using MySQL 5.0.32

You're probably using quotes (" or ') in the text you're writing which are counting as the query and causing syntax errors.

 

For example:

 

VALUES ('hi title',NOW(),'who's up for some syntax errors?','this is some text')",$connect);

 

Use PHP's htmlspecialchars() around the varaible before querying it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.