~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/mysqli/tests/020.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
mysqli bind_param/bind_result date
 
3
--SKIPIF--
 
4
<?php require_once('skipif.inc'); ?>
 
5
--FILE--
 
6
<?php
 
7
        include "connect.inc";
 
8
        
 
9
        /*** test mysqli_connect 127.0.0.1 ***/
 
10
        $link = mysqli_connect($host, $user, $passwd);
 
11
 
 
12
        mysqli_select_db($link, "test");
 
13
                
 
14
        mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
 
15
        mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, 
 
16
                                                        c3 timestamp(14), 
 
17
                                                        c4 year, 
 
18
                                                        c5 datetime, 
 
19
                                                        c6 timestamp(4), 
 
20
                                                        c7 timestamp(6))");
 
21
 
 
22
        $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
 
23
        mysqli_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
 
24
 
 
25
        $d1 = '2002-01-02';
 
26
        $d2 = '12:49:00';
 
27
        $d3 = '2002-01-02 17:46:59';
 
28
        $d4 = 2010;
 
29
        $d5 ='2010-07-10';
 
30
        $d6 = '2020';
 
31
        $d7 = '1999-12-29';
 
32
 
 
33
        mysqli_execute($stmt);
 
34
        mysqli_stmt_close($stmt);
 
35
 
 
36
        $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
 
37
 
 
38
        mysqli_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
 
39
        
 
40
        mysqli_execute($stmt);
 
41
        mysqli_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
?>
 
50
--EXPECT--
 
51
array(7) {
 
52
  [0]=>
 
53
  string(10) "2002-01-02"
 
54
  [1]=>
 
55
  string(8) "12:49:00"
 
56
  [2]=>
 
57
  string(19) "2002-01-02 17:46:59"
 
58
  [3]=>
 
59
  int(2010)
 
60
  [4]=>
 
61
  string(19) "2010-07-10 00:00:00"
 
62
  [5]=>
 
63
  string(19) "0000-00-00 00:00:00"
 
64
  [6]=>
 
65
  string(19) "1999-12-29 00:00:00"
 
66
}