--- In [email protected], "Suzi" <[EMAIL PROTECTED]> wrote:
>
> I am working with a MySQL database and PHP. I need to do a count of
> the records in the database table and output them to a script. I need
> a simple way to do this. The table is called "manufacturers".
> 
> 
> I will also need to do a list of the manufacturers and number them.
> Using their auto-assigned ID numbers will not do because we will be
> adding and subtracting manufacturers from time to time and there will
> be holes in the sequential numbers.
> 
> Can anyone help me with this? If you are able to, please email
> [EMAIL PROTECTED]
> 
> Thank you....
> Suzi
>

Suzi,

Just count the number of rows in the table using this query:

"SELECT COUNT(*) FROM manufacturers"

which will count all the rows in that table, then just output the
number you get with PHP. As far as listing the manufacturers and
numbering them, why not run a query getting their data, then
outputting it with a PHP script using a While construct on the
results. Then just use a counter variable that increments on each
iteration.

<?php
$i = 0;

while($row = mysql_fetch_array($result)){
   $i++;
   //output your mysql data here, and use $i to number it
}

HTH,
-Nick






Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to