xref: /PHP-8.1/ext/mysqli/tests/059.phpt (revision b5a14e6c)
1--TEST--
2sqlmode + bind
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11    require_once("connect.inc");
12
13    /*** test mysqli_connect 127.0.0.1 ***/
14    $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
15
16    mysqli_select_db($link, $db);
17
18    mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
19
20    mysqli_query($link,"DROP TABLE IF EXISTS mbind");
21    mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
22
23    $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
24
25    mysqli_stmt_bind_param($stmt, "ss", $a, $b);
26
27    $a = "foo";
28    $b = "bar";
29
30    mysqli_stmt_execute($stmt);
31
32    mysqli_stmt_close($stmt);
33
34    $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
35    mysqli_stmt_execute($stmt);
36
37    mysqli_stmt_bind_result($stmt, $e);
38    mysqli_stmt_fetch($stmt);
39
40    var_dump($e);
41
42    mysqli_close($link);
43    print "done!";
44?>
45--CLEAN--
46<?php
47require_once("connect.inc");
48if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
49   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
50
51if (!mysqli_query($link, "DROP TABLE IF EXISTS mbind"))
52    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
53
54mysqli_close($link);
55?>
56--EXPECT--
57string(6) "foobar"
58done!
59