开发者

how list ids in table then use this list to "not in - not exit " for other table?

I'm doing classified table which have featured ad and normal ad they are mixing up

the web will show latest 4 feature ads order by id then show other ads include featured ads and normal ads order by id but not have 4 ads which ready been show as before, but I don't what to use nested query

I have difficulty to create the list of id first 4 ads then exclude them on next query.. here's example which I did simplified, I cut out all other conditions for easy understanding.

$sql = "SELECT adid,title FROM $t_ads where featured='1'";

$featres = mysql_query($sql) or die(mysql_error().$sql);

.. how to create a string list like this $excludeadid = "1,2,3,5,7";

then

$sqlall = "SELECT adid,title FROM $t_ads where adid not in (".$excludeadid.")" ;开发者_Go百科

or may be use not exit ? or other way to do it right ? best performance


Why not do:

$sql = "SELECT adid,title FROM $t_ads where featured <> '1'";

Judging from your code this might be what you want ... Your question has some typos and is difficult to understand, so it's hard to tell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜