how to import the sql file in an exist database connection..

Regards

I'm not quite sure what you mean... Do you want to fetch an SQL file and run the query that it contains? Just fetch the contents of the file end put the contents in the mysqli_query().

this is just simple query.Do you want to do using PHP or by mysql.
For mysql just run this command(before this add path of mysql till bin in your system variable path)

mysql -u <user> -p<password> -h <hostname> <database> < /path/to/updated_script/database.sql

or another way is

mysql> Create database test
mysql> use test
Then import the database into test databse by using one of this commend:-
source test.sql
or
./ test.sql
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.