Here is a link to the reason behind this question: NOW() for DATETIME InnoDB Transaction guaranteed?
So to ensure a single transaction with any number of queries (
You can do:
<?
$now = time();
$sql = "INSERT INTO table SET field=FROM_UNIXTIME($now)";
$sql2 = "INSERT INTO table SET field=FROM_UNIXTIME($now)";
...
This avoids any possible issues of timezones, or local date formats.
Do it in MySQL, so you don't involve PHP at all:
select @now := now();
insert into .... values (@now)
select from ... where x=@now
etc....
One way could be:
<?php
$nowFormat = date('Y-m-d H:i:s');
$sql = "INSERT INTO table SET field='$nowFormat'";
$sql2 = "INSERT INTO table SET field='$nowFormat'";
...