3D-kreativ Posted July 13, 2010 Author Share Posted July 13, 2010 I do? I thought it was a difference between $res = $mysqli->query($query) or die("Could not query database"); and $res = $mysqli->multi_query($query) or die("Could not query database"); Instead of guessing how you mean, I preciate if you write the correct line of code to write this info the the table. Thanks! Link to comment https://forums.phpfreaks.com/topic/207575-how-to-get-right-timezon-when-using-now/page/2/#findComment-1085551 Share on other sites More sharing options...
ignace Posted July 14, 2010 Share Posted July 14, 2010 $mysqli->query('SET time_zone = "Europe/Stockholm"'); .. $mysqli->query('INSERT INTO ..'); Link to comment https://forums.phpfreaks.com/topic/207575-how-to-get-right-timezon-when-using-now/page/2/#findComment-1085786 Share on other sites More sharing options...
3D-kreativ Posted July 14, 2010 Author Share Posted July 14, 2010 Thanks, but I still have some problem with the second query. I get error message: unexpected T_STRING. I guess it have to do about " or '. I have tested all kinds of combinations, but still same error. Preciate some help so that we can close this post! <?php require_once('config.php'); $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE); $mysqli->query('SET time_zone = "Europe/Stockholm"'); $mysqli->query('INSERT INTO 'tracker' ( 'id' , 'ip' , 'date' , 'status' , 'userAgent' ) VALUES ( NULL , '10.10.10.10', NOW() , '10101', 'nothing'); $mysqli->close(); ?> Link to comment https://forums.phpfreaks.com/topic/207575-how-to-get-right-timezon-when-using-now/page/2/#findComment-1086099 Share on other sites More sharing options...
PFMaBiSmAd Posted July 14, 2010 Share Posted July 14, 2010 You will find that if you use double-quotes as the initial and final quotes when writing a query string that you will be better off because you can then put single-quotes and php variables directly into the query string. Also, table and column names are not enclosed in single-quotes as that would make them strings instead of table and column names. Link to comment https://forums.phpfreaks.com/topic/207575-how-to-get-right-timezon-when-using-now/page/2/#findComment-1086109 Share on other sites More sharing options...
fenway Posted July 15, 2010 Share Posted July 15, 2010 You will find that if you use double-quotes as the initial and final quotes when writing a query string that you will be better off because you can then put single-quotes and php variables directly into the query string. True, as long as you're careful... unexpected variable interpolation has caused many a bug. Link to comment https://forums.phpfreaks.com/topic/207575-how-to-get-right-timezon-when-using-now/page/2/#findComment-1086418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.