1--TEST-- 2mysqli fetch tinyint 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 tinyint, 23 c2 tinyint unsigned, 24 c3 tinyint not NULL, 25 c4 tinyint, 26 c5 tinyint, 27 c6 tinyint unsigned, 28 c7 tinyint) 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,300,0,-100,-127,+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(-23) 64 [1]=> 65 int(255) 66 [2]=> 67 int(0) 68 [3]=> 69 int(-100) 70 [4]=> 71 int(-127) 72 [5]=> 73 int(30) 74 [6]=> 75 int(0) 76} 77done! 78