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