Hello people I've got a question I wrote a script in php what scans folder and subfolders for MP3 files. then add's them to a MySQL database. The problem is that it only add's 8 files en then stops.... i put the php file and the mySQL file on a server, so you can download it and take a look at it. you can find the files on http://members.lycos.nl/Exodus-design.zip the comments are in dutch sorry for that. Please help me people Yours Truly René Ex0duS Design
the code isn't realy that big but oke here it is function Music2DB($arr_mp3, $map){ $count_mp3 = 0; while($count_mp3 < count($arr_mp3)){ $mp3file = $arr_mp3[$count_mp3]; $sql="INSERT INTO mp3files (mp3_pad, mp3_file) VALUES ('../../$map/', '$mp3file')"; mysql_query($sql) or die($foutmelding); $arr_toegevoegt[] = ("\"$mp3file\" als:<br> \"$map/$mp3file\""); $count_mp3++; } return $arr_toegevoegt; } Code (markup): send in a array containing all mp3files and $map as in the dir containing the mp3's return $arr_toegevoegt for display need more?
What is this? mysql_query($sql) or die($foutmelding); foutmelding? If that query fails it doesn't look like you will see the error. It is probably something like a bad quote in the filename. Also put echo sizeof($arr_mp3); at the top of the function so you can see how many rows are passed in
the first meens that if the mysql-query ($sql) <- the insert tag doen't work it stops the script and displays a predefined error-report. that works perfectly that's not the problem. the problem is that it only add's the first 8 row's of the inserted mp3_array. here is the link again of my files... maybe this clears it up a bit http://members.lycos.nl/renethuh/Exodus-design.zip sorry i wrong linked it (A) thanks anyway edit-- just tried it displays the sql-input query until row 8 then stops if I comment the insert to DB en retry the script..it works for all maps... don't get it anymore edit-- again don't know what i just did but it works now thank you all and cu next time!! Ex0duS Design
Yes, it is because there is something malformed in your query. Do as DCT said -- remove the actual insert and just echo the SQL. I doubt you're going to get anyone to download your app, set it up, and troubleshoot it offline.