Jump to content

[SOLVED] Help: INSERT INTO wont work properly


clown[NOR]

Recommended Posts

what i'm doin is that I'm reading my filename.m3u and I try to add the info to a database... but it sais that all 86 tracks was added but it only adds 30....

 

<?php
foreach(file("test.m3u") as $key => $file)
{
	preg_match('/^#EXTINF:[[:digit:]]+,(.*)$/',$file,$matches);
	//preg_match('/^.*$/',$file,$matches); This matches the entire line
	if ($matches) {
		$info = explode("/", $matches[1]);
		if ($info[0] == "Hip") { 
			$info[0] = "Hip-Hop";
			$info[1] = $info[3];	
		}
		$info[1] = str_replace("'", "`", $info[1]);
		$info[2] = str_replace("'", "`", $info[2]);
		$query = "INSERT INTO `playlist` VALUES ('', '$info[1]', '$info[2]', '$info[0]', '')";
		$result = mysql_query($query);
		if (!$result) { die(mysql_error()); }
		echo "Track succsessfully added<br>";
		echo "Artist: $info[1]<br>";
		echo "Tittel: $info[2]<br>";
		echo "Sjanger: $info[0]<br><br>";
	}
}
?>

 

any ideas why this is happening?

 

Thanks In Advance

- Clown

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.