i'm building a website where users can add articles. on the admin side, they can also add new fields on the add articles page.
to allow the user edit the articles, i have to query the database and then assign the results from the query to variables, usually i use the $fieldname.
the problem is, if a user added a new field while he added the article, i can't fetch the content by field anme from the rusult set of the query.
eg:
$select = $article->select();
$select->where('id =?', $id);
while ($rows = $article->fetchAll($select)){
$this->cat_id = $rows->cat_id;
$this->article_title = $rows->title;
$this->description = $rows->description;
:
:
}
but if i dont know the name of the new field(s) the user added, i can't assign it to a variable.
PS: i was thinking of a solution that would need me to fetch the name of the fields form the article_fields table, but then again i got stuck trying to assign the field name to a variable that had the same name i.e:
$select = $article_fields->select();
while ($rows = $article_fields->fetchAll($select)){
${$rows->field_name}= $rows->field_name;
;
Does anyone have any solutions??