xref: /PHP-5.3/ext/mysqli/tests/066.phpt (revision eb0e09f5)
1--TEST--
2function test: mysqli_warning object
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	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
14
15	$mysql->query("DROP TABLE IF EXISTS test_warnings");
16
17	$mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
18
19	$mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
20
21	if (($warning = $mysql->get_warnings())) {
22		do {
23			printf("Warning\n");
24		} while ($warning->next());
25	}
26
27	$mysql->close();
28	print "done!";
29?>
30--CLEAN--
31<?php
32require_once("connect.inc");
33if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
34   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
35
36if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
37	printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
38
39mysqli_close($link);
40?>
41--EXPECT--
42Warning
43done!
44