View Full Version : handling ; at the end of exported .db file

09-11-2006, 07:38 PM
i have exported a large database - that big i cant import it in one piece, so i have to import it via mysql_query and first explode the whole string.

but, i have problems with ';' at the end of each clause. how can i tell mysql to eat them?

INSERT INTO mytable a,b VALUES ('c','d');


09-11-2006, 08:14 PM
why can't you import it in one piece? if mysql could export it, it should be able to import it...
are you using some gui front-end, or the mysql command line?

using mysql_query doesn't seem particularly sensible, but http://php.net/substr might help...

09-11-2006, 08:27 PM
are you not able to upload the file to your server?
if you can then just run:

source /pathtothefile/filename
and then the file will run the inserts, table builds etc.

09-11-2006, 09:47 PM
i cannot upload it and execute in phpmyadmin because it is too big... execution time too large...
well, this with 'source' could be interesting, i have to check around:)

09-11-2006, 09:48 PM
huh... and how can i use this source thing?

09-11-2006, 11:50 PM
ftp the file to your server and then within the SQL query area of phpmyadmin run the command I showed you.

09-12-2006, 12:40 AM
//like that?
mysql_query('SOURCE "myfile.db"');

09-12-2006, 02:29 PM
You may be able to run it like that, I'm not sure. What I would do is just use the tab in phpmyadmin that is labeled SQL query.
within that only type:

SOURCE myfile.db
you will need the entire path to the file UNLESS you ftp'd the file into your mysql/data directory.