I want to convert longblob data to varchar or text.
Data saved in database like "[BLOB - 2 B]".
I want to convert this data.
How to fix it?
I want to convert longblob data to varchar or text.
Data saved in database like "[BLOB - 2 B]".
I want to convert this data.
How to fix it?
In mysql you can run:
select cast(column as char) from tablename
Or in php you can use mysql_fetch_object function to get object
Data saved in BLOB datatype in MySQL, can not be used to read the value directly. Instead, you can type-cast the datatype into some specified character set and then read value from it.
For example:-
In DOCUMENT table, DESCRIPTION field is of BLOB datatype. Then to read the data in MySQL you can cast it like e-g
SELECT CAST(DESCRIPTION AS CHAR(10000) CHARACTER SET utf8) FROM DOCUMENT;
CAST(DESCRIPTION AS CHAR(10000) CHARACTER SET utf8
will convert the BLOB datatype into character set which can be read.
If your blob file is just a text file then, just normal query should do the job.
$query = $this->db->select('column_name_that_blob_data')->from('table_name')->get();
var_dump($query->result());