2 PHP Problems

Hey,

1st problem:

I’m currently working on a form which I need to restrict on only one IP address per 3 days, so that whenever you apply, your IP address does not exist in a previous apply and is more than or equal to a certain time (3 days), the user will be able to apply again. However, I’m confused on the part handling the time, if there’s anyone who could help?

2nd problem:

Also, I’m fetching out each form that has been submitted on a seperate page, (noticing that my sql-code is currently

SELECT * FROM events_collection LIMIT $entry, $per_page

, which I need for a pagination tool), - I’d need to order all the applies by a certain date format, (the most accurate date should appear as if it was the first entry), and it shouldn’t be ordered by ID, as usual. The date format I need is

date('d.m.Y')

.

I’d be glad if someone could help me out with those problems! :frowning:

I’m not sure I fully understand the second problem, but the first one would be something similar to:


$sql = "SELECT COUNT(id) FROM events_collection WHERE ip = '" . $_SERVER['REMOTE_ADDR'] . "' 
AND apply_date >= '" . Date('Y-m-d', strtotime('-3 days')) . "'";

// execute the query

// get the result

// check if count is equal to 0, if it is allow them to enter...

it is being ordered by because that is the first things it sees. Using * for queries will have you be labeled as a lazy coder by some.

Put all your fields in your select statement, then order by date.

Ok, well, next problem:

SELECT events_collection GROUP BY events_collection ORDER BY MAX(id) DESC AND LIMIT $entry, $per_page

my website: http://knuevents.pytalhost.de/238djkejej82dkeldk92/events.php?entry=0