in reply to fetching rows problem

Instead of $rows = $st->fetchrow_array();

You should do ($rows) = $st->fetchrow_array();

The reason for this is that you want the first element of the returned array in your $row - if you do it without the parens, you will get the number of elements in the array, which is not what you want.

For your second problem, change your SQL to SELECT count(*) as c FROM members. Once you've done that, you can reference the value as  $$row{c}.

Replies are listed 'Best First'.
Re: Re: fetching rows problem
by cchampion (Curate) on Feb 25, 2004 at 23:50 UTC
    if you do it without the parens, you will get the number of elements in the array,

    No. It doesn't work that way.

    fetchrow_array in scalar context will return the first or the last field (See DBI specification change). Which one is currently undefined, but with a query that returns only one value the issue is irrelevant.