worked

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey that worked guys.. Thanks..Dan

You need to create a column in the target table similar to:
	custID SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT
When you run your INSERT query, you pass NULL to that column and the ID will
be created/auto incremented for you.

Is that what you mean?
Rich


-----Original Message-----
From: Dan Kelly [mailto:dk4210@planttel.net]
Sent: Friday, February 28, 2003 7:52 PM
To: php-db@lists.php.net
Subject: Customer id


How do I write a script that will automatically create an ID in the database. Here is a sample

-------------------------- orderform.shtml ----------------------------------------
<form action="order.php" method="post">
First Name<input type="text" name="fname"><br>
Last Name<input type="text" name="lname">

<input type="submit" name="submit" value="enter">
<input type="reset" name="Clear">

------------------Order.php ----------------------------------------------------------
<?PHP
include('dbconnect.php');

if ($submit == "enter")
{
$query = "insert into orders
(fname,lname) values
('$fname','$lname')" ;
mysql_query($query) or
die (mysql_error());
}
?>
Any Ideas? Thanks, Dan





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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux