以下是收藏壁纸的部分代码:
...
$profile = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id = $id"));
}
if ($profile['favourites'] != '') {
$from = (($page * $template['fav_wallpaper_limit']) - $template['fav_wallpaper_limit']);
$favourites = substr($profile['favourites'], 2);
/// Tried to join 2 tables, but favourites still displayed by wallpaper id
$sql = mysql_query("
SELECT
*
FROM
wallpapers AS w
JOIN favourites AS f on f.wallpaper_id = w.id
WHERE
w.id IN ($favourites) AND w.published = 1
ORDER BY
f.wallpaper_id LIMIT $from, $template[fav_wallpaper_limit]");
");
问题是,它通过存储在壁纸表中的id列显示壁纸。虽然我需要通过他们最喜欢的穿着方式来展示它们。数据存储在users表中,并为每个用户提供列收藏夹,其中包含收藏壁纸的 id 列表。
示例:, 90, 2031, 1, 34, 460, 432, ..., 2013;
有没有办法抓住这个 tada 并从中订购最爱?