1--TEST-- 2mysqli connect 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); 14 15 mysqli_query($link, "SET sql_mode=''"); 16 17 if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result")) 18 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 19 20 $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( 21 c1 date, 22 c2 time, 23 c3 timestamp(14), 24 c4 year, 25 c5 datetime, 26 c6 timestamp(4), 27 c7 timestamp(6)) ENGINE=" . $engine); 28 29 /* 30 Seems that not all MySQL 6.0 installations use defaults that ignore the display widths. 31 From the manual: 32 From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases: 33 [...] 34 Display widths (used as described in the preceding section) are no longer supported. 35 In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on, 36 the display width is ignored. 37 [...] 38 */ 39 if (!$rc) 40 $rc = @mysqli_query($link,"CREATE TABLE test_bind_result( 41 c1 date, 42 c2 time, 43 c3 timestamp, 44 c4 year, 45 c5 datetime, 46 c6 timestamp, 47 c7 timestamp) ENGINE=" . $engine); 48 49 if (!$rc) 50 printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 51 52 $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES( 53 '2002-01-02', 54 '12:49:00', 55 '2002-01-02 17:46:59', 56 2010, 57 '2010-07-10', 58 '2020','1999-12-29')"); 59 if (!$rc) 60 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 61 62 $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result"); 63 mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7); 64 mysqli_stmt_execute($stmt); 65 mysqli_stmt_fetch($stmt); 66 67 $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7); 68 69 var_dump($test); 70 71 mysqli_stmt_close($stmt); 72 mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"); 73 mysqli_close($link); 74 print "done!"; 75?> 76--CLEAN-- 77<?php 78require_once("connect.inc"); 79if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 80 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 81 82if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) 83 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 84 85mysqli_close($link); 86?> 87--EXPECT-- 88array(7) { 89 [0]=> 90 string(10) "2002-01-02" 91 [1]=> 92 string(8) "12:49:00" 93 [2]=> 94 string(19) "2002-01-02 17:46:59" 95 [3]=> 96 string(4) "2010" 97 [4]=> 98 string(19) "2010-07-10 00:00:00" 99 [5]=> 100 string(19) "0000-00-00 00:00:00" 101 [6]=> 102 string(19) "1999-12-29 00:00:00" 103} 104done! 105