Try giving a number instead of a string as a default for an int.

Also, what do you mean by blank?
If you pass '' as a value, it will become 0 when converted to an int.
What happens if you omit the column completely on the insert?

"MikeBlezien" wrote:
> 
> Hello All,
> 
> I've created a table(using MySQL 3.23.33), using default values:
> 
> DROP TABLE IF EXISTS referral;
> CREATE TABLE referral (
>  refer_id int(10) UNSIGNED DEFAULT '100' NOT NULL,
>  refer_fname varchar(20) DEFAULT '' NOT NULL,
>  refer_lname varchar(20) DEFAULT '' NOT NULL,
>  refer_email varchar(40) DEFAULT '' NOT NULL,
>  UNIQUE INDEX idx_refid (refer_id)
> ) TYPE=MYISAM;
> 
> It creates the table, no problems. But for some reason, if the refer_id is left
> blank during an INSERT, it defaults to "0" and not 100 ?? is this because of the
> UNIQUE INDEX on this column?? If your wonder, the refer_id is assigned a random
> 5 digit number within the Perl program. I was just testing to see if it would
> assign the default value if no value was assigned during an insert.
> 
> Any suggestion appreciated.
> 
> Mickalo
> 
> Thanks,
> Mike(mickalo)Blezien

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to