MySQL Query - Stupid question

Hello,
Although I’ve dealt with many many SQL queries and whatnot, I actually
don’t know how to return the number of rows it returned… I’m using the
MySQL gem and making my queries like this:

db1 = Mysql.connect(“localhost”, “root”, “root”, “project”)
@new_entries = db1.query(“SELECT * FROM new_entries”)

…but what can I do to get the number of rows as well as the data from
the table?

Thanks,

  • Jeff M.

On Apr 4, 2008, at 4:49 PM, Jeff M. wrote:

from
the table?

Thanks,

  • Jeff M.

@new_entries.num_rows

Thanks, that worked.

However, I’m doing another query in a different app using RoR… How can
I achieve the same thing? I want to get the number of rows off a query
such as this:

@grab_new_entries = NewEntries.connection.select_all(“SELECT displayname
AS displayname FROM new_entries”)

@grab_new_entries.num_rows didn’t work…

Thanks,

  • Jeff M.