Monday, November 30, 2015

Re: Retrieving data from blob data type - cakephp 3

Try this : 

http://stackoverflow.com/questions/32275558/upload-files-using-cakephp-3-and-store-it-in-a-blob

On Sunday, May 10, 2015 at 8:46:54 AM UTC+5:30, Ryan de Haast wrote:
Hi All

Can anybody explain to me how to get the data from column type that is a blob. when I retrieve the data from the database I'm able to get the details for all the columns however when a column is a blob it returns a resource. When I do a vardump on the data that's returned it shows it as resource stream

Here's some of my code, the part where I'm trying to get the contents:
foreach($list as $anArt)
{
 
pd($anArt);
  print_r($anArt->article_serialized);
  var_dump($anArt->article_serialized);
  $contents = fread($anArt->article_serialized, 1000000);
  pd($contents);
  $data = "";
  while (!feof($anArt->article_serialized)) {
   
$data .= stream_get_line($anArt->article_serialized, 1000000);
  }
 
pd($data);
}

The pd function is debug function used in the above code is just to print out the data as I'm working through it. The data in the specific column is stored as a serialized string

Please advise...

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: