just looking a way to avoid repeated post on my site, here is a basic scheme of my tables:
posts:
+----+-------------------- +
| ID | post_date |
+----+---------------------+
| 1 | 2011-11-15 08:42:50 |
+----+---------------------+
meta:
+--------------------+------------+
| post_id | meta_key | meta_value |
+---------+----------+------------+
| 1 | ip |192.168.1.10|
+---------+----------+------------+
I’m not sure how to build the query but the basics are:
- Block by IP, so, I need to provide it.
- Users can post every 300 secs.
- return empty when user is allowed, otherwise return ID and post date from their latest post.
The following query will return 1 when the user is allowed to post. The second will return the id and post date for the user’s ip last post.
You can even merge them using the ifnull function but you will not be able to use 2 columns for the second statement is that case.