PHP_PhREEEk Posted October 27, 2007 Share Posted October 27, 2007 Good solution, Thorpe, but alas, it's rare for someone to have exec privileges through PHP. That's one of the first things locked down on a shared server. Best, PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/74915-solved-executing-sql-file/page/2/#findComment-379032 Share on other sites More sharing options...
AV Posted October 27, 2007 Author Share Posted October 27, 2007 #thorpe As PHP_PhREEEK said, I either have not privilleges to use exec() #MadTechie $url = file_get_contents('db_data.sql'); function parse_mysql_dump($url, $ignoreerrors = false) { $file_content = file($url); $query = ""; foreach($file_content as $sql_line) { $tsl = trim($sql_line); if (($tsl != "") && (substr($tsl, 0, 2) != "--") && (substr($tsl, 0, 1) != "#")) { $query .= $sql_line; if(preg_match("/;\s*$/", $sql_line)) { $result = mysql_query($query); if (!$result && !$ignoreerrors) die(mysql_error()); $query = ""; } } } } Doesn't work either, no errors. Quote Link to comment https://forums.phpfreaks.com/topic/74915-solved-executing-sql-file/page/2/#findComment-379135 Share on other sites More sharing options...
AV Posted October 27, 2007 Author Share Posted October 27, 2007 Done, I used this one: http://www.ozerov.de/bigdump.php Quote Link to comment https://forums.phpfreaks.com/topic/74915-solved-executing-sql-file/page/2/#findComment-379170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.