我在 MySQL 中有带有广告的表。我想按顺序轮换横幅(不是随机)。我需要什么函数或机制来从 MySQL 表中选择广告以按顺序显示它,例如 1,然后 2,然后 3 ...然后再次 1,2,3...?
最佳答案
在不同页面加载时向同一用户显示横幅 1、横幅 2、横幅 3?
您可以使用 cookie:
//the banner that the user last saw
$banner = (isset($_COOKIE['banner']) && $_COOKIE['banner'] < 3)? $_COOKIE['banner']++ : 1;
//mysql to select and show the banner
$_COOKIE['banner'] = $banner;
关于Php + MySQL 横幅旋转器按顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2702502/