PageRenderTime 33ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/slow/ext_mysqli/test_mysqli_stmt_error_list.php

http://github.com/facebook/hiphop-php
PHP | 23 lines | 16 code | 5 blank | 2 comment | 2 complexity | d8b0f11f547ef72a9cc5b05bcb2a4bbd MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. $host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : "localhost";
  3. $port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
  4. $user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
  5. $passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : "";
  6. $db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test";
  7. $mysqli = new mysqli($host, $user, $passwd, $db, $port);
  8. /* check connection */
  9. if (mysqli_connect_errno()) {
  10. printf("Connect failed: %s\n", mysqli_connect_error());
  11. exit();
  12. }
  13. $stmt = $mysqli->stmt_init();
  14. if (!$stmt->prepare("SET a=1")) {
  15. print_r($stmt->error_list);
  16. }
  17. /* close connection */
  18. $mysqli->close();