2

MySQL Command:

set @session sql_mode = ANSI;

What is the corresponding PHP Command??

This Approach Does Not Seem To Work:

$conn= new mysqli("localhost", "root", "", "DB");
$conn->options(MYSQLI_INIT_COMMAND, "SET SQL_MODE = 'ANSI'"); 
Joshua
  • 6,643
  • 15
  • 55
  • 76
  • Looking at the manual - I don't think the options method is meant for this: http://www.php.net/manual/en/mysqli.options.php – Martin Mar 05 '10 at 07:50

3 Answers3

1

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

SET GLOBAL SQL_MODE = 'ANSI'

Young
  • 7,986
  • 7
  • 43
  • 64
1

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

$conn->query("set @session sql_mode = ANSI;");
middus
  • 9,103
  • 1
  • 31
  • 33
1

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

Joshua
  • 6,643
  • 15
  • 55
  • 76