473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Serial key in Mysql

Hi,
can anyone tell me how I can automaticly generate a serial key? - I
get an error message, when I don't provide a number for the id in the
example below. A NULL value doesn't work either.
Thank you very much for any hint.

CREATE TABLE user
(USER_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
USER_NAME varchar(10) NOT NULL,
LAST_NAME varchar(30),
FIRST_NAME varchar(30),
E_MAIL varchar(30),
M_PHONE varchar(15),
PRIMARY KEY (USER_ID)
);

$query = "INSERT INTO user (USER_ID, USER_NAME, LAST_NAME, FIRST_NAME,
E_MAIL, M_PHONE) VALUES
( $id, " .
"\"" . $nick . "\", " .
"\"" . $nachname . "\", " .
"\"" . $vorname . "\", " .
"\"" . $email . "\", " .
"\"" . $handy . "\")";
Jul 17 '05 #1
3 2094
Heinz wrote:
can anyone tell me how I can automaticly generate a serial key? - I
get an error message, when I don't provide a number for the id in the
example below. A NULL value doesn't work either.
Thank you very much for any hint.


USER_ID INT(11) AUTO_INCREMENT

JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
USER_ID INT(11) AUTO_INCREMENT


Additionally:

$query = "INSERT INTO user (USER_NAME, LAST_NAME[,...]

(So, don't assign a value to USER_ID. Let MySQL handle this)
JW

Jul 17 '05 #3
On Sun, 4 Jul 2004 13:12:34 +0200, "Janwillem Borleffs"
<jw@jwscripts.com> wrote:
Janwillem Borleffs wrote:
USER_ID INT(11) AUTO_INCREMENT


Additionally:

$query = "INSERT INTO user (USER_NAME, LAST_NAME[,...]

(So, don't assign a value to USER_ID. Let MySQL handle this)


If you're not explicitly populating fields, you still need to have a
placeholder for it. If it's the first field in the table,

insert into user ( 0, 'USER_NAME', 'USER LAST NAME'. ....) will get it
right.
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://www.databasix.com
================================================== =========================
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
12
by: Prabu Subroto | last post by:
Dear my friends... I am using postgres 7.4 and SuSE 9.1. I want to use auto_increment as on MySQL. I look up the documentation on www.postgres.com and I found "serial" . But I don't know...
15
by: Robby Russell | last post by:
I am trying to track down a method of determining what a sequence name is for a SERIAL is in postgresql. For example, CREATE TABLE foo (id SERIAL PRIMARY KEY NOT NULL, bar TEXT); \d foo...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
3
by: Mikegtr | last post by:
I need to collect and send data from a rs232 device- it is a simple temperature controller. I need to be able to collect actual temperature ,store the result in database (mysql) and show it in...
4
by: rowan | last post by:
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when...
6
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send...
2
by: cleary1981 | last post by:
Hi, I have a project coming up where i have to write a real time program that reads in data from a serial port (COM6) and inputs the data into a mysql database. I was contemplating using java for...
2
by: RubioMartin | last post by:
Hey guys, I'm currently working on a project, for wich I need an application to continually capture data recieved through serial port and export it to a database in MySql. Eventually, it would...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.