so my function post() does the next thing:
$category = serialize($postdata['post_category']);
$query = "
INSERT INTO posts(post_title, post_content, post_category)
VALUES ('$postdata[post_title]', '$postdata[post_content]', '$category')
";
inserts serialized data into the database, but i have a problem when calling a function to show only those posts which have same category, a function for that looks like this:
public function cat($cat){
global $db;
$query = "
SELECT * FROM posts
WHERE post_category LIKE '%$cat%'
";
return $db->select($query);
}
So my question is: is it better to insert unserialized data into database for this particular case (and how to do that) or is it better to pull serialized data and then unserialize it for showing some particular posts (same as previous, tried a couple of options and had no luck achieving the right result) ?