in reply to How to do simple select with Net::MySQL

MySQL has a count function. You can simplify your second query to:

my $sth = $dbh->prepare( "SELECT COUNT(*) FROM workspace WHERE name = +?"); $sth->execute( $workspace ); my ($count) = $sth->fetchrow_array();

I'm not sure what your $mysql contains, so I can't give you much more detail, but this is the standard DBI code.

Replies are listed 'Best First'.
Re^2: Now to do simple select with Net::MySQL
by doowah2004 (Monk) on Sep 15, 2004 at 05:12 UTC
    Yup, he could also use $rows = $sth->rows(); to simplify the second query. This is the syntax for DBI.pm, I am not sure if the syntax would be the same for Net::MySQL.

    Cameron