1--TEST-- 2mysqli_stmt_prepare() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 // Note: No SQL tests here! We can expand one of the *fetch() 14 // tests to a generic SQL test, if we ever need that. 15 // We would duplicate the SQL test cases if we have it here and in one of the 16 // fetch tests, because the fetch tests would have to call prepare/execute etc. 17 // anyway. 18 19 require('table.inc'); 20 21 if (!$stmt = mysqli_stmt_init($link)) 22 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 23 24 if (false !== ($tmp = mysqli_stmt_prepare($stmt, ''))) 25 printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); 26 27 if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) 28 printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); 29 30 mysqli_stmt_close($stmt); 31 32 try { 33 mysqli_stmt_prepare($stmt, "SELECT id FROM test"); 34 } catch (Error $exception) { 35 echo $exception->getMessage() . "\n"; 36 } 37 38 mysqli_close($link); 39 print "done!"; 40?> 41--CLEAN-- 42<?php 43 require_once("clean_table.inc"); 44?> 45--EXPECT-- 46mysqli_stmt object is already closed 47done! 48