Jump to content

Help needed deciphering a table in the database


aduric

Recommended Posts

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!

Link to comment
Share on other sites

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"
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated