Thanks Guys

I just needed a pointer. I decided to use the database and created two
tables, one for invoice number and one for order number then defined a
function to read the current number and the increment it.

// GET AUTO NUMBER and creates the next one
// uses the parameter tablename as $table

function get_auto_number($table)
 {
  if(!$table)
   {
    echo "The Function get_auto_number requires the peramater 'tablename' to
    allow it to know which auto number you want.<br>";
    exit;
   }
  $query = 'select number from '.$table;
  $result = mysql_query($query);
  if (!$result)
   {
    echo "Sorry there is a problem getting the auto_number from the
    table ".$table."<br>";
    exit;
   }
  $current_number = mysql_fetch_row($result);
  global $auto_number;
  $auto_number = $current_number[0];
  $query = "update ".$table." SET number = '".($auto_number +1)."'";
  $result = mysql_query($query);
 }

Simple when someone tells you what to do :o)

Thanks and regards.





"Don Mc Nair" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
>
> Is there a way for a php page to automatically increment a number and
store
> it every time the page is loaded.
>
> I want to generate an invoice number that goes up 1 everytime the HTML
form
> is sent to it.
>
> Thanks
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.435 / Virus Database: 244 - Release Date: 01/01/2003
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 02/01/2003



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to