Jump to content

Incorrect String Value Errors


shujjah
 Share

Recommended Posts

Hey I am getting this error when I try to enter an article into the databaseCould not connect: Incorrect string value: '\x92t eve...' for column 'content' at row 1sometime its \x86m and stuff like thatI figured if I remove the " ' " in the article then the error goes away .. but there are just so many " ' " used in the article that I cant remove them all .. and why cant I post " ' " in the article ? Why does it give me this error....and how to solve it :)this only doesnt happen with articles but with other scripts as well where again I try to input something into the db .. I get similar errors

	if ($_REQUEST[action] == "Add") {		if (!$_POST[SUBMIT]) {		} else {			$pform = $_POST[platform];			if ($_POST[featured] == "1") {				$featured_ins = 1;			}			if (!$_POST[image_input]) {				if (!$_FILES[image][name]) {				} else {					$time = date("Ymd");					$filenamea = str_replace("?", "", $_FILES[image][name]);					$filenameb = str_replace(":", "", $filenamea);					$filenamec = str_replace(" ", "", $filenameb);					$add = "../images/uploads/$time" . "_" . "$filenamec";					copy($_FILES[image][tmp_name], $add);					chmod("$add",0777);					$add_url = str_replace('../','', $add);				}			} else {				$add_url = $_POST[image_input];			}			$title = str_replace("'", "’", $_POST[title]);			$news = str_replace("'", "’", $_POST[news]);			$news2 = str_replace("'", "’", $_POST[news2]);			$preview = str_replace("'", "’", $_POST[preview]);			$title = str_replace("'", "’", $_POST[title]);			$content = str_replace("'", "’", $_POST[content]);			$content2 = str_replace("'", "’", $_POST[content2]);			$content3 = str_replace("'", "’", $_POST[content3]);			$content4 = str_replace("'", "’", $_POST[content4]);			$content5 = str_replace("'", "’", $_POST[content5]);			$content6 = str_replace("'", "’", $_POST[content6]);			$rating_1_text = str_replace("'", "’", $_POST[rating_1_text]);			$rating_2_text = str_replace("'", "’", $_POST[rating_2_text]);			$rating_3_text = str_replace("'", "’", $_POST[rating_3_text]);			$rating_4_text = str_replace("'", "’", $_POST[rating_4_text]);			$rating_5_text = str_replace("'", "’", $_POST[rating_5_text]);			$rating_6_text = str_replace("'", "’", $_POST[rating_6_text]);			$rating_overall_text = str_replace("'", "’", $_POST[rating_overall_text]);			if (!$_POST[gametyped] || $_POST[gametyped] == "Type in title") {				$game = "$_POST[game]";			} else {				$game = "$_POST[gametyped]";			}			$timestamp = time();						echo  $_REQUEST[ratingid]; 			$firstq = mysql_query("INSERT INTO ccms_article SET allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', preview='$preview', image=\"$add_url\", title='$title', date=\"$_POST[date]\", timestamp='$timestamp', featured=\"$_POST[featured]\", author=\"$_POST[author]\", type=\"$_POST[type]\", box=\"$_POST[box]\", rating_1=\"$_POST[rating_1]\", rating_2=\"$_POST[rating_2]\", rating_3=\"$_POST[rating_3]\", rating_4=\"$_POST[rating_4]\", rating_5=\"$_POST[rating_5]\", rating_6=\"$_POST[rating_6]\", rating_overall=\"$_POST[rating_overall]\", rating_1_text='$rating_1_text', rating_2_text='$rating_2_text', rating_3_text='$rating_3_text', rating_4_text='$rating_4_text', rating_5_text='$rating_5_text', rating_6_text='$rating_6_text', rating_overall_text='$rating_overall_text', tag=\"staff\", content='$content', content2='$content2', content3='$content3', content4='$content4', content5='$content5', content6='$content6', game=\"$game\", cat_id='$pform', rtype='c'");			if (!$firstq)  {  die('Could not connect: ' . mysql_error());  }		echo "$pform"; 	echo "			<SPAN class=\"reg_text\"><strong>$lang_a_done</strong></SPAN><br />			<meta http-equiv=\"refresh\" content=\"1; url=index.php?page=Articles&op=Articles\">\n";

is the str replace code causing the error ? table

Field Type Collation Attributes Null Default Extra Action id int(10) No auto_increment Browse distinct values Change Drop Primary Unique Index Fulltext cat_id varchar(11) latin1_swedish_ci No 0 Browse distinct values Change Drop Primary Unique Index Fulltext title varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext type varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext content text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rtype varchar(10) latin1_swedish_ci No 0 Browse distinct values Change Drop Primary Unique Index Fulltext views int(11) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext author varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext date varchar(30) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext tag varchar(55) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext game varchar(1000) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext featured varchar(5) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext image varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating decimal(2,1) No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext box varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_1 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_2 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_3 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_4 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_5 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext content2 text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext content3 text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext content4 text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext content5 text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext content6 text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_1_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_2_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_3_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_4_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_5_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_6 varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_6_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext rating_overall varchar(10) latin1_swedish_ci No 0.0 Browse distinct values Change Drop Primary Unique Index Fulltext rating_overall_text varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext timestamp int(10) No Browse distinct values Change Drop Primary Unique Index Fulltext preview varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext allow_rating int(11) No Browse distinct values Change Drop Primary Unique Index Fulltext allow_comments int(11) No Browse distinct values Change Drop Primary Unique Index Fulltext
Thanks in advance. Edited by SpEeDyZ
Link to comment
Share on other sites

The character you're trying to replace with I don't think is part of the Latin 1 character set. It's probably part of unicode instead. I'm not sure why you're trying to do that though, this is exactly what the mysql_real_escape_string function is for.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...