php - Extract column names from SHOW CREATE TABLE -
i using
$row = mysqli_fetch_row(mysqli_query($conx, "show create table $table"));
in loop grab schema data, works fine. need set column names in array. there way pull them $row array? or need run separate show columns that?
if take create table result whic this:
create table `tablename` ( `id` int(11) not null auto_increment, `name` varchar(50) not null, `message` varchar(250) not null, primary key (`id`) ) engine=innodb default charset=latin1
you create regex looks "`[a-za-z0-9_-]*`" , besides first match, column names.
php mysql
No comments:
Post a Comment