OldWest Posted December 8, 2010 Share Posted December 8, 2010 ive been doing some research on this, and i cant seem to find an answer that makes sense. im reading the manual on mysql_real_escape() and I know how to use the function, but in the description: Escapes special characters in the unescaped_string, taking into account the current character set of the connection so that it is safe to place it in a mysql_query(). If binary data is to be inserted, this function must be used. What is an example of inserting "binary data" as described above?? As far as I understand that would be any numerical values and a string would not apply.. But does not seem to add up. A binary file cannot be inserted, so Im a bit lost. Any thoughts welcome. Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 8, 2010 Share Posted December 8, 2010 Binary data would be something that you would inserted into a blob data type - http://dev.mysql.com/doc/refman/5.0/en/blob.html Most people attempt to insert files, but it can be any data you want to be treated literally without any character encoding/decoding by the database. Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/#findComment-1144215 Share on other sites More sharing options...
OldWest Posted December 8, 2010 Author Share Posted December 8, 2010 PFMaBiSmAd, ok blob helps clear it up and from what i gather now the main difference is the binary data would be determined and evaluated based on byte value and standard character strings are evaluated based on their respective character encoding data.. I also realized i mean: mysql_real_escape_string() - I left out the "string" in my original question.. I guess I can't see having much use for a blob data type but I am open to realistic applicable suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/#findComment-1144222 Share on other sites More sharing options...
OldWest Posted December 8, 2010 Author Share Posted December 8, 2010 For example, could the content of a Microsoft Word doc be inserted into a blob data type? And then used in MS Word format again from an external source? I am just trying to find some practical use for this binary data field type. Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/#findComment-1144225 Share on other sites More sharing options...
OldWest Posted December 8, 2010 Author Share Posted December 8, 2010 I'm still open to any ideas on practical use of blob with php and mysql, but I read up some articles and found it appears the actual binary data (an image for example) can be stored in a blob data type.. If I understand this right, the blob content would just be a bunch of binary 0110101 data low level deconstruction of the image file, and then can be re encoded by some means.. Am I off on this? I'm sorry if this keeps bumping this is my last comment.. Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/#findComment-1144228 Share on other sites More sharing options...
requinix Posted December 8, 2010 Share Posted December 8, 2010 Two replies in less than 10 minutes? You could use a BLOB for anything that's not human-readable (and some stuff that is). Like a Word doc. Or an image. Or a ZIP file. Or an image. Or encrypted data. Did I mention you could use it for an image? Quote Link to comment https://forums.phpfreaks.com/topic/220976-mysql_real_escape-and-binary-data/#findComment-1144242 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.