xref: /PHP-8.3/ext/mysqli/tests/029.phpt (revision a21edc52)
1--TEST--
2function test: mysqli_affected_rows
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    mysqli_select_db($link, $db);
17
18    mysqli_query($link, "DROP TABLE IF EXISTS general_test");
19    mysqli_query($link, "CREATE TABLE general_test (a INT)");
20    mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
21
22    $afc = mysqli_affected_rows($link);
23
24    var_dump($afc);
25
26    mysqli_query($link, "DROP TABLE IF EXISTS general_test");
27    mysqli_close($link);
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 general_test"))
37    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
38
39mysqli_close($link);
40?>
41--EXPECT--
42int(3)
43done!
44