007.phpt 2.3 KB

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