xref: /PHP-8.3/ext/mysqli/tests/016.phpt (revision a21edc52)
1--TEST--
2mysqli fetch user variable
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    if (!mysqli_query($link, "SET @dummy='foobar'"))
17        printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
18
19    if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
20        printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
21
22    mysqli_stmt_bind_result($stmt, $dummy);
23    mysqli_stmt_execute($stmt);
24    mysqli_stmt_fetch($stmt);
25
26    var_dump($dummy);
27
28    mysqli_stmt_close($stmt);
29    mysqli_close($link);
30    print "done!";
31?>
32--EXPECT--
33string(6) "foobar"
34done!
35