From 248538eb4a56882bb5a1e14f373f4c17b3174ffc Mon Sep 17 00:00:00 2001 From: jonl Date: Mon, 16 Jan 2012 19:23:10 +0100 Subject: [PATCH] Added sql_dbexec_rows, allows testing of affected rows --- lib/db_functions.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/db_functions.php b/lib/db_functions.php index 6122257..6ec0f53 100644 --- a/lib/db_functions.php +++ b/lib/db_functions.php @@ -33,6 +33,13 @@ function sql_dbtest_numrows ( $db, $query, $numrows ) if ( mysql_num_rows($result) == $numrows ) return true; return false; } +function sql_dbexec_rows ( $db, $query ) +{ + if ( ! mysql_select_db( $db ) ) return false; + $result = mysql_query( $query ); + if ( !$result ) return -1; + return mysql_affected_rows(); +} function sql_clean( $string ) { return addslashes( $string ); -- 2.39.2