007.phpt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. --TEST--
  2. mysqli fetch short values
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifconnectfailure.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. require_once("connect.inc");
  11. /*** test mysqli_connect 127.0.0.1 ***/
  12. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  13. if (!mysqli_query($link, "SET sql_mode=''"))
  14. printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  15. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
  16. printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  17. $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
  18. c2 smallint unsigned,
  19. c3 smallint,
  20. c4 smallint,
  21. c5 smallint,
  22. c6 smallint unsigned,
  23. c7 smallint) ENGINE=" . $engine);
  24. if (!$rc)
  25. printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  26. if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
  27. printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  28. $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
  29. mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
  30. mysqli_stmt_execute($stmt);
  31. mysqli_stmt_fetch($stmt);
  32. $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
  33. var_dump($test);
  34. mysqli_stmt_close($stmt);
  35. mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
  36. mysqli_close($link);
  37. print "done!";
  38. ?>
  39. --CLEAN--
  40. <?php
  41. require_once("connect.inc");
  42. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  43. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  44. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
  45. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  46. mysqli_close($link);
  47. ?>
  48. --EXPECT--
  49. array(7) {
  50. [0]=>
  51. int(0)
  52. [1]=>
  53. int(35999)
  54. [2]=>
  55. NULL
  56. [3]=>
  57. int(-500)
  58. [4]=>
  59. int(-32768)
  60. [5]=>
  61. int(30)
  62. [6]=>
  63. int(0)
  64. }
  65. done!