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