1

I have this table for insert files data :

|id|url|author|post_id|post_type|timestamp|

In url field i insert PHP serialize data and fetch with this function:

function _is_files_list_($id,$type){

$files = mysqli::fetch("SELECT * FROM " . NEWS_FILES . " WHERE news_id = ? AND type = ? ",$id , $type ); 

if (count($files) > 0) {

    $list_files = unserialize($files[0]['url']);
        $count  =   count($list_files[0]);
        for($i=0; $i<$count; $i++){
            $files_show[]  =   array($list_files[0][$i]);
        }
    return $files_show;

    }
else
{
    return FALSE;
}
}

and result :

if(($list = _is_files_list_($id,"download")) !== false){

    foreach ($list as $key => $data) {
        echo urldecode($data[0]);
    }
}

This worked for me and print/show url field form table but I need to show other table field ie author or timestamp using this function.

How can I generate this ?

1 Answer 1

1

did you tried something like?

foreach ($list as $key => $data) {
    echo $data[key]['url'];
    echo $data[key]['author'];
    echo $data[key]['timestamp '];
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.