Posted by: Petro Smit
Date: September 09, 2010 11:34PM
Some of my data get's cut off when being posted to my db. I have tried various things such as collate settings, I have tried various types such as varchar, char, blob(and it was a blob lol), text, etc.
i have a filter page:
$one =filter_var($val, FILTER_SANITIZE_STRING);
$stripping= filter_var($one, FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP);
$foo = str_replace("\r\n\r\n","",htmlentities($stripping));
$foo2 = str_replace("\r\n","",$foo);
$foo3 = str_replace("<","",$foo2);
$foo4 = str_replace(">","",$foo3);
$foo5 = str_replace("/","",$foo4);
$foo6 = str_replace("..","",$foo5);
$foo7 = str_replace("|","",$foo6);
$foo8 = htmlentities($foo7,ENT_COMPAT,'ISO-8859-1');
$foo9 = html_entity_decode($foo8,ENT_COMPAT,'UTF-8');
then i have the page with my query, RefNo being the column I am battling with in my db:
the fbwrite at the top obviously refers to the $_POST['RefNo']"
$Ref_No = $_POST['RefNo'];
$sql="insert into prerequisites (tr_RefNo, dte, success) values
($Ref_No, \"$dte\", \"FAILURE\")";
$rs = @mysql_query($sql,$conn) or die(mysql_error());
in the db my table is set up as:
RefNo, dte, success
all data is being captured as per their various filters but not this column.
it is supposed to look like this:
it looks like this:
It is thus cutting of the 1, and stops at the second last number before the second dash. 14 characters in total...in stead of the 30 odd it is supposed too.
I first posted this to the wrong forum, newbies, and was told there that it could be that it needs to be set to a unicoding. Thing is that the data displays fine on pages BEFORE being posted to the db, but in the db itself I have the above issue.