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

09-11-2006, 06: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, 07: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, 07: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, 08: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, 08:48 PM
huh... and how can i use this source thing?

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

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

09-12-2006, 01: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.