RE: [PHP-DB] Customer id
| From: | Jonathan Villa | Date: | Fri, 28 Feb 2003 21:47:24 +0000 |
| Subject: | RE: [PHP-DB] Customer id | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26017@lists.php.net to get a copy of this message | ||
Create a customer_id field in the database, make it primary, int, and
autoincrement
---> Jonathan
-----Original Message-----
From: Dan Kelly [mailto:dk4210@planttel.net]
Sent: Friday, February 28, 2003 6:52 PM
To: php-db@lists.php.net
Subject: [PHP-DB] 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