1--TEST-- 2mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x server) 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 test_bind_result")) 17 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 18 19 $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, 20 c3 int, c4 bigint, 21 c5 decimal(4,2), c6 double, 22 c7 varbinary(10), 23 c8 varchar(10)) ENGINE=" . $engine); 24 if (!$rc) 25 printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 26 27 if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, 28 2.6,58.89, 29 '206','6.7')")) 30 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 31 32 $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); 33 34 $c = array(0,0,0,0,0,0,0,0); 35 $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); 36 mysqli_stmt_execute($stmt); 37 mysqli_stmt_fetch($stmt); 38 mysqli_stmt_fetch($stmt); 39 mysqli_stmt_close($stmt); 40 41 $result = mysqli_query($link, "select * from test_bind_result"); 42 $d = mysqli_fetch_row($result); 43 mysqli_free_result($result); 44 45 $test = ""; 46 for ($i=0; $i < count($c); $i++) 47 $test .= ($c[$i] == $d[$i]) ? "1" : "0"; 48 if ($test == "11111111") 49 echo "ok\n"; 50 else 51 echo "error"; 52 53 mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); 54 mysqli_close($link); 55 print "done!"; 56?> 57--CLEAN-- 58<?php 59require_once 'connect.inc'; 60if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 61 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 62 63if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) 64 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 65 66mysqli_close($link); 67?> 68--EXPECT-- 69ok 70done! 71