Currently there is a piece of code like this
<code>$article['related'] = array(); if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) { foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) { $value['uri'] = fetch_article_url($value); $article['related'][$raid] = $value; } }</code>
Its function is to generate ID corresponding records in the portal_article_related table after adding related articles, and then obtain the relevant fields in the portal_article_title table through the ID. Now I want to build on this, and also need to obtain the portal_category through the catid in the portal_article_title table. How to write the relevant records in the table?
Thank you.
Currently there is a piece of code like this
<code>$article['related'] = array(); if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) { foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) { $value['uri'] = fetch_article_url($value); $article['related'][$raid] = $value; } }</code>
Its function is to generate ID corresponding records in the portal_article_related table after adding related articles, and then obtain the relevant fields in the portal_article_title table through the ID. Now I want to build on this, and also need to obtain the portal_category through the catid in the portal_article_title table. How to write the relevant records in the table?
Thank you.
Just write the SQL statement directly, there is no need to use this AR writing method.
Even native sql statements should be easy to implement