1--TEST-- 2mysqli fetch (bind_param + bind_result) 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 /*** test mysqli_connect 127.0.0.1 ***/ 13 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); 14 15 if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read")) 16 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 17 18 $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint, 19 col3 int, col4 bigint, 20 col5 float, col6 double, 21 col7 date, col8 time, 22 col9 varbinary(10), 23 col10 varchar(50), 24 col11 char(20)) ENGINE=" . $engine); 25 if (!$rc) 26 printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 27 28 if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)")) 29 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 30 31 mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4); 32 33 $c1 = 1; 34 $c2 = "foo"; 35 $c3 = "foobar"; 36 $c4 = 3.14; 37 38 mysqli_stmt_execute($stmt); 39 mysqli_stmt_close($stmt); 40 41 if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read")) 42 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 43 44 mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); 45 mysqli_stmt_execute($stmt); 46 47 mysqli_stmt_fetch($stmt); 48 49 $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11); 50 51 var_dump($test); 52 53 mysqli_stmt_close($stmt); 54 mysqli_query($link, "DROP TABLE IF EXISTS insert_read"); 55 mysqli_close($link); 56 print "done!"; 57?> 58--CLEAN-- 59<?php 60require_once("connect.inc"); 61if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 62 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 63 64if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read")) 65 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 66 67mysqli_close($link); 68?> 69--EXPECTF-- 70array(11) { 71 [0]=> 72 int(1) 73 [1]=> 74 NULL 75 [2]=> 76 NULL 77 [3]=> 78 NULL 79 [4]=> 80 NULL 81 [5]=> 82 float(3.14) 83 [6]=> 84 NULL 85 [7]=> 86 NULL 87 [8]=> 88 NULL 89 [9]=> 90 %unicode|string%(3) "foo" 91 [10]=> 92 %unicode|string%(6) "foobar" 93} 94done!