I want to import data from sql dump generated by phpMyAdmin programmatically using php.
I found some questions but they did not helped me because i don't have shell access and there is no problems due to foreign-key constraints.
Create tables from SQL dump generated by phpmyadmin using kohana
Programmatic Equivalent Of Import in phpMyAdmin
----EDIT----
This is code i am using, it works fine but i think it breaks when there is some html in database.
sqldump_to_statements($contents)
{
// remove c style and inline comments with -- and #
$comment_patterns = array('/\/\*.*(\n)*.*(\*\/)?/','/\s*--.*\n/','/\s*#.*\n/');
$contents = preg_replace($comment_patterns, "\n", $contents);
$statements = explode(";\n", $contents);
$statements = preg_replace("/\s/", ' ', $statements);
return $statements;
}