yami007 Posted January 3, 2009 Share Posted January 3, 2009 ??? i wonder if i can display files from a specific directory which arent stored in the database yet only, i wanna use this tool to show the files in my songs directory and i dont wanna see the files that i already have in my database please help Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/ Share on other sites More sharing options...
Nitroware Posted January 3, 2009 Share Posted January 3, 2009 COuld you expand on what you are saying please? I little more information would help. Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/#findComment-728517 Share on other sites More sharing options...
yami007 Posted January 3, 2009 Author Share Posted January 3, 2009 well there's a function called readdir, i know but it displays all the files in the directory for ex: i'm displaying a folder of my website mp3, i use this tool to check if the file is already in my mp3 directory and copy and paste into my database, but i only dont want to display the mp3 files that i already have in the data.. Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/#findComment-728528 Share on other sites More sharing options...
CMC Posted January 3, 2009 Share Posted January 3, 2009 Why don't you just delete all the records from the database and make a script that will go through the directory, automatically adding each file to the database? That way you know for sure that all the files will be in the database. Probably the easiest method too. Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/#findComment-728530 Share on other sites More sharing options...
yami007 Posted January 3, 2009 Author Share Posted January 3, 2009 hmm, i dont get it CMC, Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/#findComment-728531 Share on other sites More sharing options...
yami007 Posted January 3, 2009 Author Share Posted January 3, 2009 OK guys i've done it, thanks anyway for the ones who wants to know this is how i finally came up with a nice result ^^ <?php require_once("../includes/connection.php"); ?> <html> <head> <title>Show songs</title> </head> <body bgcolor="#ffffff"> <?php $rep = Array(); $handle = @opendir("../songs"); while (false !== ($f = readdir($handle))) { if ($f != ".." && $f != "." && $f != "index.php" && $f != "Thumbs.db") { $rep[] = $f; } } closedir($handle); sort ($rep); reset ($rep); ?> <table width="700" cellspacing="0" cellpadding="0" border="1"> <tr> <th height="30">Titre</th> <th height="30">Source</th> </tr> <?php while (list ($key, $filename) = each ($rep)) { list ($name, $ext) = split ('[.]', $filename); ?> <?php $html = "<tr> <td height=\"30\"><input type=\"text\" value=\"$name\"></td> <td height=\"30\"><input type=\"text\" value=\"$filename\"></td> </tr>"; ?> <?php $checkSong = mysql_query("SELECT source FROM songs WHERE source='$filename'"); $song_exist = mysql_num_rows($checkSong); if ($song_exist > 0) { unset($html); } else { ($html); } ?> <?php echo $html; ?> <?php } ?> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/139279-solved-is-there-any-way-i-can-do-this/#findComment-728533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.