fatkatie Posted March 11, 2019 Share Posted March 11, 2019 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 Quote Link to comment Share on other sites More sharing options...
requinix Posted March 11, 2019 Share Posted March 11, 2019 Can you be more specific about this "not being read" or "read twice"? What had you changed when this started happening? Quote Link to comment Share on other sites More sharing options...
fatkatie Posted March 11, 2019 Author Share Posted March 11, 2019 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. Quote Link to comment Share on other sites More sharing options...
fatkatie Posted March 11, 2019 Author Share Posted March 11, 2019 @#$@#$@! 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. Quote Link to comment Share on other sites More sharing options...
requinix Posted March 11, 2019 Share Posted March 11, 2019 mb_check_encoding is fine to use if you want to verify you're receiving valid string data. If your "binding" does that already then you don't need to add it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.