Mysql/php treating left/right quote differently from regular quotes, how to stop it? -
i having trouble submitting form data mysql database. mysql/php seems treating open , closed quotes (a.k.a. “ , ”) differently other characters such regular (") or (<) (>) or (&).
what gets submitted database “ , ” , don't want that. want open , closed quotes appear other character. odd if hit "back button" on browser , resubmit same post, want submitted database. want (“) , (”) submit correctly on first try.
i haven't tested characters see work , don't, have tested , appears open , closed special quotes ones giving trouble.
here query structure:
$content = mysql_real_escape_string($_post['content']); $topictitle = mysql_real_escape_string($_post['topictitle']); $topiccategory = mysql_real_escape_string($_post['topiccategory']); $date = date('y-m-d h:i:s'); $query = "insert `ttable` (`topictitle`,`user`,`cat`,`postcontent`,`posttime`,`replylast`) values ('".$topictitle."','".$_session['user']."','".$topiccategory."','".$content."','".$date."','".$date."')";
my form long , dont think relevant won't post that.
any idea might cause behavior?
note: mysql_real_escape_string not seem escaping open/close quotes...
update: changing method "get" instead of "post" can see view source...the $_get['content'] view source shows code, not quote. must happening before mysql query page. still can't see why converts special quote code. haven't done it.
update2: put string_replace in right before mysql query , right after mysql_real escape string. figured @ least replace instances of “ , ” left , right quotes again. instead, in database is....“ , †... there's funny goin on...
update3: update2 missing fact put (
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
) @ head of page when happened.
update4: this looks similar problem, doesnt fix mine. putting meta tag @ top of pages creates new problem special quotes turned “ , †... should perhaps note on mac.
Comments
Post a Comment