1--TEST-- 2mysqli bind_result datetimes 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 17mysqli_query($link, "SET sql_mode=''"); 18 19mysqli_query( 20 $link, 21 "CREATE TABLE test_bind_result_datetime( 22 c1 date, 23 c2 time, 24 c3 timestamp, 25 c4 year, 26 c5 datetime, 27 c6 timestamp(4), 28 c7 timestamp(6) 29 ) ENGINE=" . get_default_db_engine() 30); 31 32mysqli_query($link, "INSERT INTO test_bind_result_datetime VALUES( 33 '2002-01-02', 34 '12:49:00', 35 '2002-01-02 17:46:59', 36 2010, 37 '2010-07-10', 38 '2020','1999-12-29')"); 39 40$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result_datetime"); 41mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); 42mysqli_stmt_execute($stmt); 43mysqli_stmt_fetch($stmt); 44 45$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); 46 47var_dump($test); 48 49mysqli_stmt_close($stmt); 50mysqli_close($link); 51print "done!"; 52?> 53--CLEAN-- 54<?php 55require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 56tear_down_table_on_default_connection('test_bind_result_datetime'); 57?> 58--EXPECT-- 59array(7) { 60 [0]=> 61 string(10) "2002-01-02" 62 [1]=> 63 string(8) "12:49:00" 64 [2]=> 65 string(19) "2002-01-02 17:46:59" 66 [3]=> 67 string(4) "2010" 68 [4]=> 69 string(19) "2010-07-10 00:00:00" 70 [5]=> 71 string(24) "0000-00-00 00:00:00.0000" 72 [6]=> 73 string(26) "1999-12-29 00:00:00.000000" 74} 75done! 76