xref: /PHP-7.2/ext/mysqli/tests/016.phpt (revision f1d7e3ca)
1--TEST--
2mysqli fetch user variable
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10	require_once("connect.inc");
11
12	/*** test mysqli_connect 127.0.0.1 ***/
13	$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
14
15	if (!mysqli_query($link, "SET @dummy='foobar'"))
16		printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
17
18	if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
19		printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
20
21	mysqli_stmt_bind_result($stmt, $dummy);
22	mysqli_stmt_execute($stmt);
23	mysqli_stmt_fetch($stmt);
24
25	var_dump($dummy);
26
27	mysqli_stmt_close($stmt);
28	mysqli_close($link);
29	print "done!";
30?>
31--EXPECTF--
32string(6) "foobar"
33done!
34