CodeIgniter Forums
mysql blob problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: mysql blob problem (/thread-37340.html)



mysql blob problem - El Forum - 01-06-2011

[eluser]quasiperfect[/eluser]
hi

i'm going nuts over a problem i'm having
i have a blob field that contains my session data
on local server (windows7 wamp64) when i run a select over the data from the blob field i get all contents in text format

something like this
Code:
mysql> select session_data  from sessions;
+--------------------------------------+
| session_data                         |
+--------------------------------------+
| valoare_cod|i:2;txt_cod|s:5:"6 - 4"; |
+--------------------------------------+
1 row in set (0.00 sec)

on my live server (centos)i get something like this

Code:
mysql> SELECT session_data FROM sessions;
+------------------------------------------------------------------------------------------+
| session_data                                                                             |
+------------------------------------------------------------------------------------------+
| SgMM1StVLITU6V_kszNHLVlkZmB2a82Ktzz2XB7XZgtnMAQAcJw4ItZnSqy7V-f3Wf9AdH9ZRelOmJpTkWr6Yg.. |
+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

what i'm doing wrong here ? any idea what the problem could be ?

update

i forgot to mention the application works correctly on both servers my problem is when i try to do a select on the blob
Code:
SELECT session_data FROM sessions where session_data like '%sometexthere%'
on local server i get the results, on live server i get 0 results


mysql blob problem - El Forum - 01-06-2011

[eluser]Victor Michnowicz[/eluser]
Weird. I would make sure that your database character set and collation are setup correctly in CodeIgniter. I know CI defaults to "utf8_general_ci" for the collation while a lot of servers default to "utf8_sweedish_ci." I don't know if this would cause the problems you are having, but it is worth a shot.


mysql blob problem - El Forum - 01-06-2011

[eluser]quasiperfect[/eluser]
thanks for u'r suggestion

on the server phpmyadmin reports utf8_general_ci

in ci config i have
Code:
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

so i don't think that's the problem


mysql blob problem - El Forum - 01-06-2011

[eluser]Victor Michnowicz[/eluser]
Are you sure it says "utf8_general_ci"? In your example code it says "utf8_general_". There is no "ci" part.

Assuming varchar fields work correctly - If you are on MySQL 5.0.3 or later, varchars can be anywhere from 0 to 65,535 characters (prolly more than enough for what you need)


mysql blob problem - El Forum - 01-06-2011

[eluser]quasiperfect[/eluser]
sorry i just copied wrong
i converted the field to text same thing on windows i see the text even with phpmyadmin on linux no luck tested on 2 servers