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