1--TEST-- 2mysqli insert (bind_param + bind_result) small integer types 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 8mysqli_check_skip_test(); 9?> 10--FILE-- 11<?php 12require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 13 14 $link = default_mysqli_connect(); 15 16 // To get consistent result without depending on the DB version/setup 17 mysqli_query($link, "SET sql_mode=''"); 18 19 mysqli_query( 20 $link, 21 "CREATE TABLE insert_bind_smallint( 22 c1 smallint unsigned, 23 c2 smallint unsigned, 24 c3 smallint, 25 c4 smallint, 26 c5 smallint, 27 c6 smallint unsigned, 28 c7 smallint 29 )" 30 ); 31 32 $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_smallint VALUES (?,?,?,?,?,?,?)"); 33 mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); 34 35 $c1 = -23; 36 $c2 = 35999; 37 $c3 = NULL; 38 $c4 = -500; 39 $c5 = -9999999; 40 $c6 = -0; 41 $c7 = 0; 42 43 mysqli_stmt_execute($stmt); 44 mysqli_stmt_close($stmt); 45 46 $stmt = mysqli_prepare($link, "SELECT * FROM insert_bind_smallint"); 47 mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); 48 mysqli_stmt_execute($stmt); 49 mysqli_stmt_fetch($stmt); 50 51 $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); 52 53 var_dump($test); 54 55 mysqli_stmt_close($stmt); 56 mysqli_close($link); 57 print "done!"; 58?> 59--CLEAN-- 60<?php 61require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 62tear_down_table_on_default_connection('insert_bind_smallint'); 63?> 64--EXPECT-- 65array(7) { 66 [0]=> 67 int(0) 68 [1]=> 69 int(35999) 70 [2]=> 71 NULL 72 [3]=> 73 int(-500) 74 [4]=> 75 int(-32768) 76 [5]=> 77 int(0) 78 [6]=> 79 int(0) 80} 81done! 82