Re: [Jason] more fav lists
Hi Jason,
I'm a coworker of maurice and i am working on this solution. Now i am able to add multiple favorites lists, that works fine!
Now i would like to show all the favorites (from all favoriteslist) in one foreach, is this possible.
Now i use this code to display each favorites list:
$currentUserNum = mysql_escape( @$CURRENT_USER['num'] );
// get favorite from LINKS record nums
$tableOrTagLinks = mysql_escape('links'); // update this with your table or tag name
$favoriteNumsQueryLinks = "SELECT recordNum FROM {$TABLE_PREFIX}_website_favorites WHERE tableOrTag = '$tableOrTagLinks' AND createdByUserNum = '$currentUserNum'";
$tableOrTagDocs = mysql_escape('docs'); // update this with your table or tag name
$favoriteNumsQueryDocs = "SELECT recordNum FROM {$TABLE_PREFIX}_website_favorites WHERE tableOrTag = '$tableOrTagDocs' AND createdByUserNum = '$currentUserNum'";
$tableOrTagFaq = mysql_escape('faq'); // update this with your table or tag name
$favoriteNumsQueryFaq = "SELECT recordNum FROM {$TABLE_PREFIX}_website_favorites WHERE tableOrTag = '$tableOrTagFaq' AND createdByUserNum = '$currentUserNum'";
$tableOrTagNews = mysql_escape('news'); // update this with your table or tag name
$favoriteNumsQueryNews = "SELECT recordNum FROM {$TABLE_PREFIX}_website_favorites WHERE tableOrTag = '$tableOrTagNews' AND createdByUserNum = '$currentUserNum'";
// load matching records
list($favoriteLinksRecords, $favoriteLinksMetaData) = getRecords(array(
'tableName' => 'links_dashboards', // update this with your table or tag name
'perPage' => '10',
'where' => " num IN ($favoriteNumsQueryLinks) ",
'loadCreatedBy' => false,
'allowSearch' => false,
));
list($favoriteDocsRecords, $favoriteDocsMetaData) = getRecords(array(
'tableName' => 'documenten_mem', // update this with your table or tag name
'perPage' => '10',
'where' => " num IN ($favoriteNumsQueryDocs) ",
'loadCreatedBy' => false,
'allowSearch' => false,
));
list($favoriteFaqRecords, $favoriteFaqMetaData) = getRecords(array(
'tableName' => 'faq', // update this with your table or tag name
'perPage' => '10',
'where' => " num IN ($favoriteNumsQueryFaq) ",
'loadCreatedBy' => false,
'allowSearch' => false,
));
list($favoriteNewsRecords, $favoriteNewsMetaData) = getRecords(array(
'tableName' => 'news', // update this with your table or tag name
'perPage' => '10',
'where' => " num IN ($favoriteNumsQueryNews) ",
'loadCreatedBy' => false,
'allowSearch' => false,
));
It will not surprise me if this can be done much easier...