Jump to content

Foreach loop on sql file does not work...


dakke

Recommended Posts

I have a sql file locally, which I try to import in my db. I pasted it into a txt file, though I assume that I can use the sql file as well...

 

I try to do the following:

$file = file_get_contents("includes/database.txt") or exit ("Unable to get content file!");
	$query = preg_split("/;/", $file) or exit ("Unable to split content file!");
	foreach($connection as $query) {
	$sql = $query;
	$execute = mysql_query($sql, $connection) or exit ("Unable to execute file!");
	}	

 

However, nothing happens. Can someone enlighten me, who is extremely limited in php and just starting to learn it all.

Link to comment
https://forums.phpfreaks.com/topic/186669-foreach-loop-on-sql-file-does-not-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.