Jump to content

MySQL BLOB Data Type


nafees

Recommended Posts

Depends what kind of data is in there....  BLOB is just binary.

 

 

Luckily, with PHP, handling BLOB stuff isn't too hard.  It's actually just about like a normal column.

 

 

$q = mysql_query("SELECT some_blob_column FROM some_table LIMIT 1");

$r = mysql_fetch_row($q);

echo $r[0];

 

 

for example.

Link to comment
https://forums.phpfreaks.com/topic/135406-mysql-blob-data-type/#findComment-705454
Share on other sites

hello there,

 

thanks a lot for ur reply. i was looking to add a Microsoft Word formated document into the BLOB data field. My objective is to retrieve tht formated data from the BLOB field using php. can u tell me how to do tht. I can retrieve plain text data but failed to retrieve the formated one.

 

Regards,

 

Nafees

Link to comment
https://forums.phpfreaks.com/topic/135406-mysql-blob-data-type/#findComment-705601
Share on other sites

<?php
//pretend $q is a query resource
if($q && mysql_num_rows($q)) {
    $r = mysql_fetch_assoc($q);
    header("Content-Type: application/msword"); //not sure if application/msword is actually the word document MIME type
    //I doubt it is, but I don't feel like Googling.
    echo $r['blob_column_name'];
}

Link to comment
https://forums.phpfreaks.com/topic/135406-mysql-blob-data-type/#findComment-705616
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.