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

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.