1--TEST-- 2mysqli fetch float values 3--INI-- 4precision=12 5--EXTENSIONS-- 6mysqli 7--SKIPIF-- 8<?php 9require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 10mysqli_check_skip_test(); 11?> 12--FILE-- 13<?php 14require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 15 16 $link = default_mysqli_connect(); 17 18 // To get consistent result without depending on the DB version/setup 19 mysqli_query($link, "SET sql_mode=''"); 20 21 mysqli_query( 22 $link, 23 "CREATE TABLE test_bind_fetch_float( 24 c1 float(3), 25 c2 float, 26 c3 float unsigned, 27 c4 float, 28 c5 float, 29 c6 float, 30 c7 float(10) unsigned 31 ) ENGINE=" . get_default_db_engine() 32 ); 33 34 35 mysqli_query($link, "INSERT INTO test_bind_fetch_float (c1,c2,c3,c4,c5,c6,c7) 36 VALUES (3.1415926535,-0.000001, -5, 999999999999, sin(0.6), 1.00000000000001, 888888888888888)"); 37 38 $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_float"); 39 mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); 40 mysqli_stmt_execute($stmt); 41 mysqli_stmt_fetch($stmt); 42 43 $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); 44 45 var_dump($test); 46 47 mysqli_stmt_close($stmt); 48 mysqli_close($link); 49 print "done!"; 50?> 51--CLEAN-- 52<?php 53require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 54tear_down_table_on_default_connection('test_bind_fetch_float'); 55?> 56--EXPECT-- 57array(7) { 58 [0]=> 59 float(3.14159) 60 [1]=> 61 float(-1.0E-6) 62 [2]=> 63 float(0) 64 [3]=> 65 float(1000000000000) 66 [4]=> 67 float(0.564642) 68 [5]=> 69 float(1) 70 [6]=> 71 float(888889000000000) 72} 73done! 74