xref: /PHP-7.4/ext/mysqli/tests/029.phpt (revision e3e67b72)
1--TEST--
2function test: mysqli_affected_rows
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    mysqli_select_db($link, $db);
16
17    mysqli_query($link, "DROP TABLE IF EXISTS general_test");
18    mysqli_query($link, "CREATE TABLE general_test (a INT)");
19    mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
20
21    $afc = mysqli_affected_rows($link);
22
23    var_dump($afc);
24
25    mysqli_query($link, "DROP TABLE IF EXISTS general_test");
26    mysqli_close($link);
27    print "done!";
28?>
29--CLEAN--
30<?php
31require_once("connect.inc");
32if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
33   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
34
35if (!mysqli_query($link, "DROP TABLE IF EXISTS general_test"))
36    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
37
38mysqli_close($link);
39?>
40--EXPECT--
41int(3)
42done!
43