php - Execute multiple queries from file fast -


this question has answer here:

i have file queries. that:

 drop table if exists #__assets;  create table if not exists `#__assets` ( `id` int(10) unsigned not null auto_increment comment 'primary key', `parent_id` int(11) not null default '0' comment 'nested set parent.', `lft` int(11) not null default '0' comment 'nested set lft.', `rgt` int(11) not null default '0' comment 'nested set rgt.', `level` int(10) unsigned not null comment 'the cached level in nested tree.', `name` varchar(50) not null comment 'the unique name asset.\n', `title` varchar(100) not null comment 'the descriptive title asset.', `rules` varchar(5120) not null comment 'json encoded access control.', primary key (`id`), unique key `idx_asset_name` (`name`), key `idx_lft_rgt` (`lft`,`rgt`), key `idx_parent_id` (`parent_id`) ) engine=innodb auto_increment=92 default charset=utf8;  insert #__assets values("1","0","0","165","0","root.1","root asset","{\"core.login.site\":{\"6\":1,\"2\":1},\"core.login.admin\":{\"6\":1},\"core.login.offline\":{\"6\":1},\"core.admin\":{\"8\":1},\"core.manage\":{\"7\":1},\"core.create\":{\"6\":1,\"3\":1},\"core.delete\":{\"6\":1},\"core.edit\":{\"6\":1,\"4\":1},\"core.edit.state\":{\"6\":1,\"5\":1},\"core.edit.own\":{\"6\":1,\"3\":1}}"); ... 

and so...

i can split file row row , execute. slow have big file. know faster way solve problem?

thanks!

get file content in variable string

and use mysqli_multi_query()

// condition queries must ; seprated

 <?php    $queries = get_file_content("filename.sql/or_anyotherfile");   $result =  mysqli_multi_query($con,$queries);   ?> 

something works me


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -