views:

159

answers:

1

A Table has

   Field: data
   Type: text

select data from t1 where id = 5
*************************** 1. row ***************************


  data:
1 row in set (0.00 sec)

How to print the exact data from table ?

NOTE: the Field data is not empty

+1  A: 

What you are doing is correct. Look at the following example:

mysql> create table baz (data TEXT);
Query OK, 0 rows affected (0.20 sec)

mysql> insert into baz (data) values ("Four score and seven years ago, our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal");
Query OK, 1 row affected (0.06 sec)

mysql> select data from baz\G
*************************** 1. row ***************************
data: Four score and seven years ago, our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal
1 row in set (0.00 sec)

If you don't see any "data", then it means the field is empty, or contains only whitespace.

EDIT:

If you're seeing "boxes" as you state in your comment, then it could be a character encoding mismatch, or possibly you have binary data in your TEXT field. Please provide the output from the following:

SHOW CREATE TABLE foo;
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
hobodave
the field is not empty
joe
Based on what you show me, it is - or it contains whitespace.
hobodave
it showing some small boxes
joe
Then, it sounds like you have non-character data in your TEXT field. Or your character-set / encoding is off.
hobodave
Regardless, select data from foo; retrieves the data in the TEXT field.
hobodave