开发者

Extract MySQL Blob and add to PHP array?

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 don开发者_StackOverflowe?


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 explode to 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜