in reply to Perl and MySQL: Get number of rows affected

$query = $db->query($sql_query); $number = $query->affectedrows the variable $sql_query is a string, and contains your SQL syntax for your query. There is no semi-colon at the end of the query in this case though. You can directly insert the string if you like as well, instead of using $sql_query. The variable $query now contains the identifier for the query, and will be used from now on for accessing that query's data. $number contains the number of rows in the database affected by query.
  • Comment on Re: Perl and MySQL: Get number of rows affected

Replies are listed 'Best First'.
Re^2: Perl and MySQL: Get number of rows affected
by perrin (Chancellor) on Jul 15, 2006 at 16:31 UTC
    There is no affectedrows() method in DBI. If you were thinking of the rows() method, that doesn't work for SELECT statements.