1--TEST-- 2mysqli fetch char/text 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8?> 9--FILE-- 10<?php 11 include 'connect.inc'; 12 13 /*** test mysqli_connect 127.0.0.1 ***/ 14 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); 15 16 mysqli_select_db($link, $db); 17 18 if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch")) 19 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 20 21 if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine)) 22 printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 23 24 if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')")) 25 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 26 27 if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')")) 28 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 29 30 if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')")) 31 printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 32 33 if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')")) 34 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 35 36 if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1")) 37 printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 38 39 $c1 = $c2 = NULL; 40 mysqli_stmt_bind_result($stmt, $c1, $c2); 41 mysqli_stmt_execute($stmt); 42 $i = 4; 43 while ($i--) { 44 mysqli_stmt_fetch($stmt); 45 $test = array($c1, $c2); 46 var_dump($test); 47 } 48 49 mysqli_stmt_close($stmt); 50 mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); 51 mysqli_close($link); 52 print "done!"; 53?> 54--CLEAN-- 55<?php 56require_once 'connect.inc'; 57if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 58 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 59 60if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) 61 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 62 63mysqli_close($link); 64?> 65--EXPECT-- 66array(2) { 67 [0]=> 68 string(10) "1234567890" 69 [1]=> 70 string(15) "this is a test0" 71} 72array(2) { 73 [0]=> 74 string(10) "1234567891" 75 [1]=> 76 string(15) "this is a test1" 77} 78array(2) { 79 [0]=> 80 string(10) "1234567892" 81 [1]=> 82 string(15) "this is a test2" 83} 84array(2) { 85 [0]=> 86 string(10) "1234567893" 87 [1]=> 88 string(15) "this is a test3" 89} 90done! 91