aduric Posted April 17, 2012 Share Posted April 17, 2012 Hi, I am attempting to create a custom module to do with products and I need to be able to write to the tblproducts table in the database. So far, most columns make sense except the 'downloads' column. I would have thought that it would contain a FK reference to tbldownloads but it appears to be cryptic text. So, my question is, how exactly are the download files associated with the product? Thanks! 0 Quote Link to comment Share on other sites More sharing options...
aduric Posted April 17, 2012 Author Share Posted April 17, 2012 So with trial and error I *might* have figured it out, although I'm not certain. The text takes the form of: a:<number of items>{i:<index of item in list>;s:1:"<index of item in tbldownloads>"; ... } 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted April 17, 2012 Share Posted April 17, 2012 Its a serialized array within the field. Run it through unserialize() to get an array of download IDs from tbldownloads. For example, if the field contains <?php $serialized = 'a:2:{i:1;s:2:"18";i:2;s:2:"19";}'; $outputArr = unserialize($serialized); var_dump($outputArr); ?> which will output: array(2) { [1]=> string(2) "18" [2]=> string(2) "19" } 0 Quote Link to comment Share on other sites More sharing options...
aduric Posted April 17, 2012 Author Share Posted April 17, 2012 Thanks Frank. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.