Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Excluding results from MySQL queries

Feb 29, 2008 3:01PM PST

Hello! I wrote a script to retrieve recent forum topics from my IPB forums. The script works, however, the problem is that even private forums are showing up. Even though people can't get to those threads, I would like for them not to show up. here is the script:

$q = "SELECT * FROM ibf_topics WHERE forum_id != 48||49||53||54||7||8||38||37||42||43||11||12 ORDER BY last_post DESC";
$r = mysql_query($q);

As you can see, I have tried excluding by forum ID and using the || operator. I have also tried to use OR instead of || and it didn't help. Can someone tell me what I'm doing wrong?

Discussion is locked

- Collapse -
Try AND in stead of OR
Feb 29, 2008 11:57PM PST

If forum_id != 48 AND forum_id != 49 AND ...
or any shorter notation that I don't know about.


Kees

- Collapse -
thanks
Mar 1, 2008 12:22PM PST

thanks that worked.