1--TEST-- 2multiple binds 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 mysqli_select_db($link, $db); 16 17 mysqli_query($link,"DROP TABLE IF EXISTS mbind"); 18 mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))"); 19 20 $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)"); 21 22 mysqli_stmt_bind_param($stmt, "is", $a, $b); 23 24 $a = 1; 25 $b = "foo"; 26 27 mysqli_stmt_execute($stmt); 28 29 mysqli_stmt_bind_param($stmt, "is", $c, $d); 30 31 $c = 2; 32 $d = "bar"; 33 34 mysqli_stmt_execute($stmt); 35 mysqli_stmt_close($stmt); 36 37 $stmt = mysqli_prepare($link, "SELECT * FROM mbind"); 38 mysqli_stmt_execute($stmt); 39 40 mysqli_stmt_bind_result($stmt, $e, $f); 41 mysqli_stmt_fetch($stmt); 42 43 mysqli_stmt_bind_result($stmt, $g, $h); 44 mysqli_stmt_fetch($stmt); 45 46 var_dump((array($e,$f,$g,$h))); 47 48 mysqli_close($link); 49 print "done!"; 50?> 51--CLEAN-- 52<?php 53require_once("connect.inc"); 54if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 55 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 56 57if (!mysqli_query($link, "DROP TABLE IF EXISTS mbind")) 58 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 59 60mysqli_close($link); 61?> 62--EXPECT-- 63array(4) { 64 [0]=> 65 int(1) 66 [1]=> 67 string(3) "foo" 68 [2]=> 69 int(2) 70 [3]=> 71 string(3) "bar" 72} 73done! 74