www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to output part of feild using mysql

  1. #1
    Join Date
    Mar 2005
    Posts
    208

    Arrow How to output part of feild using mysql

    Hi all. i got a huge list of mp3 that they are in diffrent folders. I put all the songs infor in mysql database in a table called files. I want a query db that output foldernames for me .The folder name is part of feiled called filename in files table. The value of filename is like this stored in db :

    http://localhost/wimpy5recursive/mp3s/album1/song1.mp3
    http://localhost/wimpy5recursive/mp3s/album2/song4.mp3
    where the bold part is the foldername. i want to print folder name.Note:mp3s is the root folder for mp3s.The whole point is to list all folders name and link to page that holds songs inside those folders.

    Furthermore, i want a query all feilds info for songs in each given folder.What i mean is that for each folder it lists all songs info iside that folder.I want to be able to tell the query what folder i want to list its song.Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,334
    I cannot visualize a reasonable way to do this via SQL. (I'm not saying there is NO way to do, but I don't see it.) If I were doing it I would re-design the data table to keep the file path and and file name in separate fields. Then I'd write a PHP or Perl script to extract the current data, parse it using a regexp function, then re-insert it into the database.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Mar 2005
    Posts
    208

    Arrow

    Quote Originally Posted by NogDog
    I cannot visualize a reasonable way to do this via SQL. (I'm not saying there is NO way to do, but I don't see it.) If I were doing it I would re-design the data table to keep the file path and and file name in separate fields. Then I'd write a PHP or Perl script to extract the current data, parse it using a regexp function, then re-insert it into the database.
    Many thanks for u reply. well these are the fields in table :

    Code:
    filename|artist|album|title|track|comments|genre|seconds|filesize|bitrate

    I already have a query that list songs by album .I have huge list of mp3 in diffrent folders some of them are collections from diffrent artis and albums and some does not have good tags so i want create seperate page using a query that list folders for me and then link that page to another page that lists songs inside that folder.

    I use this getid3 php script that uploads for me song info to above db.That script does not put the foldernames as seperate field and it is huge program and hard to edit. I be happy if i find a way to over come problem or is there any php prog that stores folder names to current db since i easily can use one of empty fields for it ?Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles