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