Jump to content

Recommended Posts

I am writing a blog, but I have been getting same error on my mysql.

My MySQL field types are postid/(int(6)), title/(varchar(200)), category/(varchar(200)), post/(longtext), identification/(int(11)), date_crated/(timestamp).

 

What I noticed is when I have really long post (100 words), I get error like " You have an error in your SQL syntax". Plus my timestamps is giving all zero values. Anybody has any idea what is wrong with my table?

Link to comment
https://forums.phpfreaks.com/topic/84421-mysql-error/
Share on other sites

function dump_in_mysql_post()
	{
	$title = stripslashes($_POST['title']);
	$category = stripslashes($_POST['category']);
	$body = stripslashes($_POST['body']);

	echo $title . "<br>". $category . "<br>" . $body . "<br>";

	$dump_in_mysql_post = "INSERT INTO `post` VALUES('$postid', '$title', '$category', '$body', '$identification', '$date_created')";
	$dump_in_mysql_post = mysql_query($dump_in_mysql_post);
		if(!$dump_in_mysql_post)
		{
			echo "Error on querying post ". "<b> ". mysql_error() . "</b>";
		}
		else
		{
			echo "Title : " . $title . " <br> " ;
			echo "Category: " .  $category . " <br> ";
			echo "Body: " . $body . " <br> ";
			echo "Identification : " . $identification;
			echo "Blog entry has been submitted";
		}

	}

Link to comment
https://forums.phpfreaks.com/topic/84421-mysql-error/#findComment-430041
Share on other sites

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.