in reply to How do i check if a mysql database is empty?

$email="" does not do what you think. It computes the numeric values for both sides and compares. You whould need eq for that. See perlop for that.

Next, you don't need to select Email from the table to check if it is empty or not. Use SELECT COUNT(*) FROM foo and get the number of rows. That way, you know how many rows of data you have. i.e. If you have 0 rows, you have an empty table. (not an empty database)

Update: oops! Thanks 3dan (++)

Replies are listed 'Best First'.
Re: Re: How do i check if a mysql database is empty?
by edan (Curate) on Nov 27, 2003 at 08:07 UTC

    $email="" does not do what you think. It assigns the empty string to $email. No comparison takes place.

    --
    3dan