From: jonl Date: Mon, 16 Jan 2012 18:23:10 +0000 (+0100) Subject: Added sql_dbexec_rows, allows testing of affected rows X-Git-Url: https://git.defcon.no/?a=commitdiff_plain;h=248538eb4a56882bb5a1e14f373f4c17b3174ffc;p=hermes Added sql_dbexec_rows, allows testing of affected rows --- 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 );