012.phpt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --TEST--
  2. mysqli fetch mixed values 2
  3. --INI--
  4. precision=12
  5. --SKIPIF--
  6. <?php
  7. require_once('skipif.inc');
  8. require_once('skipifconnectfailure.inc');
  9. ?>
  10. --FILE--
  11. <?php
  12. require_once("connect.inc");
  13. /*** test mysqli_connect 127.0.0.1 ***/
  14. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  15. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
  16. printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  17. $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
  18. c3 int, c4 bigint,
  19. c5 float, c6 double,
  20. c7 varbinary(10),
  21. c8 varchar(10)) ENGINE=" . $engine);
  22. if (!$rc)
  23. printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  24. if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
  25. 2.6,58.89,
  26. '206','6.7')"))
  27. printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  28. $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
  29. mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
  30. mysqli_stmt_execute($stmt);
  31. mysqli_stmt_fetch($stmt);
  32. $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
  33. var_dump($test);
  34. mysqli_stmt_close($stmt);
  35. mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
  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_result"))
  45. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  46. mysqli_close($link);
  47. ?>
  48. --EXPECTF--
  49. array(8) {
  50. [0]=>
  51. int(120)
  52. [1]=>
  53. int(2999)
  54. [2]=>
  55. int(3999)
  56. [3]=>
  57. int(54)
  58. [4]=>
  59. float(2.6)
  60. [5]=>
  61. float(58.89)
  62. [6]=>
  63. string(3) "206"
  64. [7]=>
  65. %unicode|string%(3) "6.7"
  66. }
  67. done!