What are the potential pitfalls of using the timestamp data type in MySQL for storing timestamps from PHP?

The potential pitfall of using the timestamp data type in MySQL for storing timestamps from PHP is that it automatically converts the timestamp to UTC before storing it. This can lead to discrepancies if the PHP application and MySQL server are in different timezones. To solve this issue, you can use the datetime data type in MySQL, which does not perform timezone conversion.

// Using datetime data type in MySQL to store timestamps from PHP
$timestamp = date('Y-m-d H:i:s');
$query = "INSERT INTO table_name (timestamp_column) VALUES ('$timestamp')";
// Execute the query