Let assume we've database table My_table with (id-name)
CREATE TABLE `drink` (
`id` int(5) NOT NULL auto_increment,
`name` varchar(64) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9034 ;
INSERT INTO `My_table` VALUES (1, 'my name is someone');
How to automate adding new fields using php or something else so that it can be (id-new-name)
and where new = name after we replace spaces
to -
using
$new = str_replace(' ', '-', trim($name));
so the table become
CREATE TABLE `drink` (
`id` int(5) NOT NULL auto_increment,
`new` varchar(64) NOT NULL default '',
`name` varchar(64) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9034 ;
INSERT INTO `My_table` VALUES (1, 'my-name-is-someone', 'my name is someone');
I'd like to operate it cause it has half million of lines and impossible to do it manually so any idea!
Thanks for help.