Skip to content

Commit ffe4382

Browse files
author
Georg Richter
committed
test for mysqli_stmt_affected_rows (delete command)
1 parent 6997d50 commit ffe4382

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

ext/mysqli/tests/046.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
mysqli_stmt_affected_rows (delete)
3+
--FILE--
4+
<?php
5+
include "connect.inc";
6+
7+
/*** test mysqli_connect 127.0.0.1 ***/
8+
$link = mysqli_connect("localhost", $user, $passwd);
9+
10+
mysqli_select_db($link, "test");
11+
12+
mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
13+
mysqli_query($link, "CREATE TABLE test_affected (foo int)");
14+
15+
mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
16+
17+
$stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
18+
mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT);
19+
20+
$c1 = 2;
21+
22+
mysqli_execute($stmt);
23+
$x = mysqli_stmt_affected_rows($stmt);
24+
25+
mysqli_stmt_close($stmt);
26+
var_dump($x==1);
27+
28+
mysqli_close($link);
29+
?>
30+
--EXPECT--
31+
bool(true)

0 commit comments

Comments
 (0)