# Ignore rows in MySQL query?

**URL:** <https://forum.kirupa.com/t/ignore-rows-in-mysql-query/242486>\
**Category:** programming\
**Created:** [October 26, 2007, 1:39pm UTC](https://forum.kirupa.com/t/ignore-rows-in-mysql-query/242486 "2007-10-26T13:39:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mentha](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@mentha](https://forum.kirupa.com/u/mentha)\
**Post date:** [October 26, 2007, 1:39pm UTC](https://forum.kirupa.com/t/ignore-rows-in-mysql-query/242486/1 "2007-10-26T13:39:07Z")

</div>

I’m working on a simple guestbook with IP-blocking possibility. Therefor I’ve created 2 tables, 1 for the guestbook itself, which also logs the visitors IP and 1 with the banned IP’s. So far everything works as planned. I can block an IP, after which I get a message in my guestbook backend mentioning that the IP has been banned.

Now I want to start building the frontend, but I can’t figure out the right query to create for getting all rows EXCEPT the ones that have the banned IP. I can get all rows and then in my WHILE statement (mysql\_fetch\_array) skip the ones that are banned, but that means that I don’t get the right total of entries per page. LIMIT 10 for example gives 10 rows, but if 3 of them have a banned IP, I only get 7 entries on my page and I want 10…

Any ideas? Thanks in advance!
