Sort foreign keys to ensure correct order
Create TYPE_TIMESTAMP
Use timestamp type in ajax.php
Use single quotes when appropriate