tags:

views:

142

answers:

2

Hello everyone,

I have this table:

CREATE TABLE IF NOT EXISTS `events` (
  `evt_id` int(11) NOT NULL AUTO_INCREMENT,
  `evt_name` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT 'ucfirst',
  `evt_description` varchar(100) DEFAULT NULL,
  `evt_startdate` date NOT NULL,
  `evt_enddate` date DEFAULT NULL,
  `evt_starttime` time DEFAULT NULL,
  `evt_endtime` time DEFAULT NULL,
  `evt_amtpersons` int(11) DEFAULT NULL,
  `sts_id` int(11) NOT NULL,
  `adr_id` int(11) DEFAULT NULL,
  `evt_amtPersonsSubs` tinyint(4) NOT NULL DEFAULT '0',
  `evt_photo` varchar(50) DEFAULT NULL,
  `sys-mut-dt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `sys-mut-user` varchar(20) DEFAULT NULL,
  `sys-mut-id` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`evt_id`),
  KEY `sts_id` (`sts_id`),
  KEY `adr_id` (`adr_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;

But when i add in data into evt_name my first charachter is not capitalized. Any idea's?

Further information: MySQL client version: 5.1.37

I want to do this in the database so that i don't have to always ucfirst with php.

+3  A: 

...what?

If I'm reading this right, it will just set the default value of evt_name to the string ucfirst. Try inserting a blank row and see if I'm reading that right.

If you're really against using ucfirst in PHP, you'll probably have to still call ucfirst every time in the query. Or you could only use ucfirst on display, and not in the database.

Matchu
ok I thought i just could aragne it in the table itself without doing it in each query.
sanders
+3  A: 

ucfirst is a function...you defined it as Default-Value for the cell. Use it like this:

INSERT INTO events SET evt_name = UCFIRST($value)
Bobby