I need to extract a list of keywords from a MySQL database. Each keyword is separated by a comma. I need to read it from the blob, then add it to the array. How would this be done?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First retrieve the blob from the database
SELECT blob FROM tbl WHERE id=123. The PHP code used to execute the query depends on the SQL API you are using: mysql, mysqli, PDO, …Once you have a string containing the comma separated data use
explodeto split the words into an array$array = explode(',', $string).Note that you should probably use the TEXT datatype in this case. Unlike BLOB it is collation and encoding aware. Use BLOB for pure binary data like a JPEG file.