<[EMAIL PROTECTED]> writes:

[...]

> So what I am trying is this.
>
> $last_row ="SELECT from firebase_content LAST_INSERT_ID()";
> $last_row_query = $dbi->query($last_row);
> $last_row_result = $row->id;

LAST_INSERT_ID() only works if you just inserted an element; it's
maintained per-connection.  See:

    http://dev.mysql.com/doc/mysql/en/getting-unique-id.html

If your items are numbered sequentially, try just using:

   SELECT COUNT(*) FROM firebase_content;

to get the count.  That's very fast; it comes from the table summary
information, IIRC.  I use a similar solution for a similar problem,
and have had great luck with it.

To deal better with deleted items, you could periodically renumber
your articles to avoid gaps in numbering.

It would be great if MySQL had an optimization for this case.

----ScottG.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to