29.09.2012, 14:35
The id field doesn't really serve a purpose in this case. If you want to insert it anyway, then use default as value.
A tip from my part though: If you add a unique key on the 'username' field, you can use the INSERT .. ON DUPLICATE KEY UPDATE syntax. This saves you the extra select query.
PHP код:
INSERT INTO aliases (id, username, ip) VALUES (default, '%s', '%s')
PHP код:
INSERT INTO aliases (id, username, ip) VALUES (default, '%s', '%s') ON DUPLICATE KEY UPDATE ip = '%s';