On Thu, Oct 03, 2002 at 03:59:48PM -0400, chad kellerman wrote: > Hi everyone, > > I thought $sth->fetchrow_array would do the trick but its not. I am > using mysql on linux and I have a query: > > SELECT hostname FROM tblHost WHERE status="started"; > > which returns a list of hostnames. I though the fetchrow_array would > return a array of hostnames but it does not seem to. It seems to only > return the first hostname unless I put it in a while loop.
fetchrow_array *fetch*es a single *row* and returns an *array* of values from the row. In this specific case, the array happens to contain just one value, because you're only selecting one value from each row. Try the various fetchall_... methods instead, such as fetchall_arrayref. Ronald
