开发者

How To Set MySql SQL_MODE to ANSI from PHP

开发者 https://www.devze.com 2022-12-22 04:00 出处:网络
MySQL Command: set @session sql_mode = ANSI; What is the c开发者_如何学Pythonorresponding PHP Command??

MySQL Command:

set @session sql_mode = ANSI;

What is the c开发者_如何学Pythonorresponding PHP Command??

This Approach Does Not Seem To Work:

$conn= new mysqli("localhost", "root", "", "DB");
$conn->options(MYSQLI_INIT_COMMAND, "SET SQL_MODE = 'ANSI'"); 


It seems that you have missed the scope variable,try this:

SET GLOBAL SQL_MODE = 'ANSI'


Does this work for you? (Sorry, can't test at the moment)

$conn->query("set @session sql_mode = ANSI;");


I ended up using mysqli_init instead of new mysqli() and everything worked fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消