just as:
$myquery = "select * from sometable";
$myresult = mysql_query($myquery, $mysql_link);
$rows = $mysql_fetch_array($myresult)
$count = 1;
while ($rows)
{
print(" <tr><td>$count</td><td>$rows[0]</td><td>$rows[1]</td>...</tr>
$count++;
}
I would do the same thing in perl, C++, or Java.
Curtis
On Sun, 16 Feb 2003, Michael T. Babcock wrote:
> Luc Foisy wrote:
>
> >I didn't say it had nothing to do with the data, I said it had nothing to do with
>the data in the database.
> >
>
> I'm making the assumption as a DBA that _all_ the data relevant is in
> the database; so the comment I made was equivalent to the above.
>
> >As I said, sure I could make external functions to do the job. But why? (I did
>because I have no choice at the moment)
> >
>
> If the row number is not _used_ but only for show, it _shouldn't_ be
> done by the database to properly sequester and segment your data and
> program models. However, if you're going to use that row number in any
> way (like: <li><a href="/showdetails.php?id=$rowid">$row data</a></li>)
> then it should be an auto_increment value from the database itself
> (although you may very well display a fake programmatically generated ID
> as well).
>
> >1. There are a lot of functions that return values that have nothing to do with
>data contained in the database. Math functions for one, they calculate return values
>using data that is in the database. And many many other functions. Why not one more.
> >
>
> They calculate results based on data in the database; the row number is
> a meta-value. Unless its a _rowid type value, you're talking about a
> cosmetic value that isn't data-related.
>
> >In the 4.x series the developers implemented SQL_CALC_FOUND_ROWS and FOUND_ROWS(),
>something that could just have easily been handled by external programming...
> >
>
> Those values can be useful within a query though. Also, someone may
> have paid for those features (hint).
>
> >3. Going through the archives, I have seen many many people ask for it.
> >
>
> Most of those people are now using the methods everyone else on here has
> described because they're correct. Lots of people have asked for other
> things that may never be done by the MySQL team as well.
>
> >4. Those numbers probably already exist, how else does it ORDER BY, it has to put
>the results in an array of some kind
> >
>
> I have my doubts, I bet they don't exist :)
>
> For a pseudo-php example:
>
> $results = Select("id, name from names order by name limit $start,
> $maxperpage");
> print "<ol>";
> while ($row = mysql_fetch_array($results))
> {
> ?> <li><a href="showdetail.php?id=<?php echo $row['id'] ?>"><?php echo
> $row['name'] ?></a></li> <?php
> }
> echo "</ol>
>
> You'll see how the 'ol' tag provides me with numbered results up to the
> number of $maxperpage on each display, but I use the actual unique ID
> value from the database as a reference value. The 'ol' values are just
> as easily put in the PHP itself, of course, since they have nothing to
> do with the data (no association to that data).
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php