irwan

how to synchronize the time on PHP and MySQL

Mar 14th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2. mysql_connect("localhost","root","") or die("Error");
  3. $sql = "SELECT UNIX_TIMESTAMP() as time";
  4. $test = mysql_query($sql);
  5. $timenow= mysql_fetch_assoc($test);
  6. echo "Time in MySQL = " . date("d-m-Y H:i:s",$timenow['time']);
  7. echo '<br />';
  8. echo "Time in PHP = " .date("d-m-Y H:i:s");
  9. ?>
Advertisement
Add Comment
Please, Sign In to add comment