xref: /PHP-5.4/ext/mysqli/tests/037.phpt (revision eb0e09f5)
1--TEST--
2function test: mysqli_field_count()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10
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, "DROP TABLE IF EXISTS test_result");
19
20	mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
21
22	mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
23	$ir[] = mysqli_field_count($link);
24
25	mysqli_real_query($link, "SELECT * FROM test_result");
26	$ir[] = mysqli_field_count($link);
27
28
29	var_dump($ir);
30
31	mysqli_query($link, "DROP TABLE IF EXISTS test_result");
32	mysqli_close($link);
33	print "done!";
34?>
35--CLEAN--
36<?php
37require_once("connect.inc");
38if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
39   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
40
41if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
42	printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
43
44mysqli_close($link);
45?>
46--EXPECT--
47array(2) {
48  [0]=>
49  int(0)
50  [1]=>
51  int(2)
52}
53done!