Data truncation when retrieving data from MySQL database with prepared statements
Posted
by KSiimson
on Stack Overflow
See other posts from Stack Overflow
or by KSiimson
Published on 2010-04-28T21:53:30Z
Indexed on
2010/04/28
21:57 UTC
Read the original article
Hit count: 290
I have a script that retrieves multiple products using prepared statements. Like putting loops into loops, I have prepared statements in prepared statements - so there is a prepared statement for retrieving all products, a prepared statement to retrieve all images for that product, a prepared statement to get all attributes for that products, and so on. This does not work with one MySQLi instance, so I use multiple MySQLi objects that are opened and closed when needed. It usually works fine, but sometimes, especially when displaying multiple products, some data is truncated.
For example - MicoLoans becomes MicoLoa. There was an actual spelling mistake here - now when I changed MicoLoans to MicroLoans, the same page displayed MicroLoa... So the same number of characters was truncated from the end.
It is sort of consistent where it appears - for example there can be descriptions for 8 products, and description of 1 product is heavily truncated. When I add 9th product, the short description is still truncated for that same product as before.
Any ideas?
© Stack Overflow or respective owner