Jump to content

How to insure good form data winds up in the table.


fatkatie

Recommended Posts

I just started populating a mysql table with data collected from a form posting.  I do the dance ...

$post_partnumber_source = html_entity_decode(trim(fvs($_POST['nsel_pnsrc'])));where fvs is
function fvs($string){$string = filter_var($string,  FILTER_SANITIZE_STRING); return $string; }

And then I use PDO and binding.

Something has happened.  Something bad.

My PHP $sth->fetch(PDO::FETCH_OBJ) loops are failing.  All the records are not
being read (some seem to be read twice)... and it happens around the record when form input was starting to be used.

It's got to illegal data messing this up.  So, my question is, what now?

Will

mb_check_encoding() 

solve this or am I missing something very  basic.

Thank you.

 

mysql  Ver 15.1 Distrib 10.1.37-MariaDB, for Win32 (AMD64), Using configuration as supplied by xampp

Link to comment
Share on other sites

while ($pending || $row = $sth->fetch(PDO::FETCH_OBJ)) {
   $pending = false;
   $hn = $row->houseid;
   writeData("READ $hn", __FILE__, __LINE__);
}

There's the loop.  houseid starts repeating.  I found the record but I don't see anything wrong yet. Newlines?  I'm going to rewrite the record with the check and see what that does.

Link to comment
Share on other sites

@#$@#$@!

You spend all day on something that has nothing to do with anything.  It was a stupid join.

mb_check_encoding

But, I would like  to know if mb_check_encoding() is worth anything.  I've relied on binding which has never failed me.

Thank you.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.