At 11:03 PM -0400 4/4/11, Dev Bhattacharyya wrote:
Tedd,
Try this:
DROP TABLE IF EXISTS `xyz`;
CREATE TABLE IF NOT EXISTS `xyz` (
`imagename` varchar(30) NOT NULL,
`image` blob
) ENGINE=MyISAM;
INSERT INTO `xyz` VALUES ('PDF FIle',
0x255044462d312e340d25e2e3cfd30d0a38322);
INSERT INTO `xyz` VALUES ('No Image', NULL);
SELECT `imagename` , `image` , OCTET_LENGTH( `image` )/1024 FROM
`xyz` LIMIT 0 , 30
-- image is the BLOB field.
Hope that helps.
Bingo! That worked.
The query was:
$query = "SELECT OCTET_LENGTH(`image`) AS size FROM table WHERE id='1' ";
And then I pull 'size' from the result and divided it by 1024. I know
I could have divided the value in the query, but it was more semantic
to do it in the php script. I have other similar divisions there.
Thanks much,
tedd
--
-------
http://sperling.com/
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php