Member_2_6492660_1
asked on
ASP code help to produce output list as url
ASP code below,
Would like to produce the list of output given a url so they can click on the line item and it will play the song.
currently the output just lists the name of the songs.
Is it also possible to have each line of output have a checkbox so they can select which songs they want to play and then it could create a play list for them mysong.m3u that would produce a separate page with just the list of songs they selected.
Any help would be great
Would like to produce the list of output given a url so they can click on the line item and it will play the song.
currently the output just lists the name of the songs.
Is it also possible to have each line of output have a checkbox so they can select which songs they want to play and then it could create a play list for them mysong.m3u that would produce a separate page with just the list of songs they selected.
<%
dim searchWord
searchWord = Request.Querystring("song")
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=xxxxx;Password=xxxxxxxx;Initial Catalog=Music;Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433"
strSQL1 = "SELECT dbo.Artists.artistname, dbo.Recordings.RecordingTitle, dbo.Tracks.TrackTitle, dbo.Tracks.TrackFileName FROM dbo.Artists INNER JOIN dbo.Recordings ON dbo.Artists.artistid = dbo.Recordings.ArtistID INNER JOIN dbo.Tracks ON dbo.Recordings.RecordingID = dbo.Tracks.RecordingID WHERE (dbo.Artists.artistname = '"& searchWord&"') OR (dbo.Recordings.RecordingTitle = '"& searchWord&"') OR (dbo.Tracks.TrackTitle = '"& searchWord&"')"
Set oRs1=oConn.Execute(strSQL1,lngRecs,1)
if not oRs1.eof then
do until oRs1.eof
response.write "<div class=""results"">"&oRs1("artistname")&" "&oRs1("RecordingTitle")&" "&oRs1("TrackTitle")&" "&oRs1("TrackFileName")&"</div>"
oRs1.movenext
loop
end if
%>
Any help would be great
how do you normally play the files? where are that paths to the file stored?
Your checkbox would probably look like this
Then your output would be a comma separated text string. To see for your self, do a
Take a look at how forms work to start with http://www.w3schools.com/html/html_forms.asp
response.write "<div class=""results""><input type=""checkbox"" name=""selectItem"" value="""&oRs1("TrackFileName")&"""> "&oRs1("artistname")&" "&oRs1("RecordingTitle")&" "&oRs1("TrackTitle")&" "&oRs1("TrackFileName")&"</div>"
Then your output would be a comma separated text string. To see for your self, do a
response.write request.form("selectItem")
Take a look at how forms work to start with http://www.w3schools.com/html/html_forms.asp
To parse the response of a comma delimited field, you will create an array and loop through it.
dim PlayList
PlayList = request.form("selectItem")
arrPlayList = split(PlayList,",")
For each item in arrPlayList
response.write Item &"<br>"
' Or play song
next
http://www.w3schools.com/vbscript/func_split.asp
ASKER
Scott
Thanks for replying
Sorry for the delay back long day at work today.
I put the checkbox code it and now it displays a check box that's great.
You second Posting with the array where do I place that code
Thanks in advance
Thanks for replying
Sorry for the delay back long day at work today.
I put the checkbox code it and now it displays a check box that's great.
You second Posting with the array where do I place that code
<%
dim searchWord
searchWord = Request.Querystring("song")
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=xxxxx;Password=xxxxxxxx;Initial Catalog=Music;Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433"
strSQL1 = "SELECT dbo.Artists.artistname, dbo.Recordings.RecordingTitle, dbo.Tracks.TrackTitle, dbo.Tracks.TrackFileName FROM dbo.Artists INNER JOIN dbo.Recordings ON dbo.Artists.artistid = dbo.Recordings.ArtistID INNER JOIN dbo.Tracks ON dbo.Recordings.RecordingID = dbo.Tracks.RecordingID WHERE (dbo.Artists.artistname Like '"& searchWord&"') OR (dbo.Recordings.RecordingTitle Like '"& searchWord&"') OR (dbo.Tracks.TrackTitle Like '"& searchWord&"')"
Set oRs1=oConn.Execute(strSQL1,lngRecs,1)
if not oRs1.eof then
do until oRs1.eof
response.write "<div class=""results""><input type=""checkbox"" name=""selectItem"" value="""&oRs1("TrackFileName")&"""> "&oRs1("artistname")&" "&oRs1("RecordingTitle")&" "&oRs1("TrackTitle")&" "&oRs1("TrackFileName")&"</div>"
oRs1.movenext
loop
end if
%>
Thanks in advance
ASKER
Big Monty:
The music gets played on any media player, works on Computer IE, Firefox Chrome, Safari, on iPad iPhone Android etc.
www.tomsmp3.com check it out.
The files are on a drive connected to the web server using IIS 6.0
The all are in a sql database from which I can run the query from.
Working on fine turning the query.
Thanks in advance
The music gets played on any media player, works on Computer IE, Firefox Chrome, Safari, on iPad iPhone Android etc.
www.tomsmp3.com check it out.
The files are on a drive connected to the web server using IIS 6.0
The all are in a sql database from which I can run the query from.
Working on fine turning the query.
Thanks in advance
You are going to place the checkbox's in a form. When the submit button is used, the form data for the check box's will be a comma delimited string.
You would place the array on the page you are submitting the data to.
You would place the array on the page you are submitting the data to.
ASKER
Scott little confused about where this goes.
You are talking about the ASP Code that I listed above correct?
I tried adding it after the end if but that did not work
You suggestion?
You are talking about the ASP Code that I listed above correct?
I tried adding it after the end if but that did not work
You suggestion?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Scott
Tested the above code and it worked.
Now working on getting that code into my asp code.
Thanks for the help will post results later
Tested the above code and it worked.
Now working on getting that code into my asp code.
Thanks for the help will post results later
ASKER
Scott
Back to my scripting and seem to not be able to incorporate your code from above.
Try placing the form in my asp code but every time I tested the page I got http 500
Removed the code now page works.
How can I add the submit function to mode code below?
I am working on page2.asp which will be music3.asp
The above code is music2.asp
Back to my scripting and seem to not be able to incorporate your code from above.
Try placing the form in my asp code but every time I tested the page I got http 500
Removed the code now page works.
How can I add the submit function to mode code below?
<%
dim searchWord
dim strFont1
dim strFont2
searchWord = Request.Querystring("song")
strFont1 = "<font style=""font-size: 20px; color: #ff0000; font-family:verdana"">"
strFont2 = "<font style=""font-size: 16px; color: #000000; font-family:verdana"">"
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=xxxxxxxxxxxx;Password=xxxxxxxxxxxxxx;Initial Catalog=Music;Network Library=DBMSSOCN;Data Source=xxx.xxx.xxx.xxx,1433"
strSQL1 = "SELECT dbo.Artists.artistname, dbo.Recordings.RecordingTitle, dbo.Tracks.TrackTitle, dbo.Tracks.TrackFileName FROM dbo.Artists INNER JOIN dbo.Recordings ON dbo.Artists.artistid = dbo.Recordings.ArtistID INNER JOIN dbo.Tracks ON dbo.Recordings.RecordingID = dbo.Tracks.RecordingID WHERE (dbo.Artists.artistname Like '%"& searchWord&"%') OR (dbo.Recordings.RecordingTitle Like '%"& searchWord&"%') OR (dbo.Tracks.TrackTitle Like '%"& searchWord&"%')"
Set oRs1=oConn.Execute(strSQL1,lngRecs,1)
Response.Write strFont1 & "Select Songs you Wish to Add to Your Playlist then click on Submit button<br />"
Response.Write "<br />"
if not oRs1.eof then
do until oRs1.eof
response.write strFont2 & "<div class=""results""><input type=""checkbox"" name=""selectItem"" value="""&oRs1("TrackFileName")&"""> "&oRs1("artistname")&" "&oRs1("RecordingTitle")&" "&oRs1("TrackTitle")&" "&oRs1("TrackFileName")&"</div>"
oRs1.movenext
loop
end if
%>
I am working on page2.asp which will be music3.asp
The above code is music2.asp
Try turning on errors / sending to the browser http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default
If you don't have access to this, you will have to ask your host to do it for you.
The 500 errors are generic. By turning on asp errors, you will get the line number and possible issue.
If you don't have access to this, you will have to ask your host to do it for you.
The 500 errors are generic. By turning on asp errors, you will get the line number and possible issue.
ASKER
Scott
Thanks this is for IIS 7 and IIS 8
I am using IIS 6 and I found this
http://www.reedolsen.com/show-errors-for-classic-asp-pages-in-iis-6/
I do have that setting on
But I got the Submit button added and working sorta
Making progress Will post more later.
Thanks this is for IIS 7 and IIS 8
I am using IIS 6 and I found this
http://www.reedolsen.com/show-errors-for-classic-asp-pages-in-iis-6/
I do have that setting on
But I got the Submit button added and working sorta
Making progress Will post more later.
ASKER
Scoot Good new got the Page working now
Check it out
When you select the songs from the search output the new page created lists only the songs you check off
Now I need to convert that out to a URL so they can click on it to play it
any thoughts?
Check it out
When you select the songs from the search output the new page created lists only the songs you check off
Now I need to convert that out to a URL so they can click on it to play it
any thoughts?
On http://www.tomsmp3.com/page2.asp I end up with
M:\Music\MP3MusicAlbums\Gu ess Who\Billboard Top 100 - 1970\02-Billboard Top 100 - 1970-03 No Sugar Tonight.mp3
You need a simple link http://www.w3schools.com/html/html_links.asp
M:\Music\MP3MusicAlbums\Gu
You need a simple link http://www.w3schools.com/html/html_links.asp
<a href="M:\Music\MP3MusicAlbums\Guess Who\Billboard Top 100 - 1970\02-Billboard Top 100 - 1970-03 No Sugar Tonight.mp3">No Sugar Tonight</a>
Actually, the link has to be relative to your domain.
<a href="M:\Music\MP3MusicAlb ums\Guess Who\Billboard Top 100 - 1970\02-Billboard Top 100 - 1970-03 No Sugar Tonight.mp3">No Sugar Tonight</a>
You probably actually need to access the mp3 via file system object if it is outside of the domain. That would be another question though.
<a href="M:\Music\MP3MusicAlb
<a href="www.tomsmp3.com/folder/folder/something.mp3">Something</a>
You probably actually need to access the mp3 via file system object if it is outside of the domain. That would be another question though.
ASKER
Scott
Can not get the url to work in page2.asp
Any thoughts
Also I just saw your last post:
If you look at the results of page2.asp
It is in the correct format just need to make it a url output line.
Then I have a routine that will convert the path but I need the url created first.
Can not get the url to work in page2.asp
<%
if request.form<>"" then
strSongs=request.form("selectItem")
arraySongs=split(strSongs,",")
for each song in arraySongs
response.write <a href="song&"> </a>
next
else
response.write "You did not post any data yet<br>"
end if
%>
<input type="button" value="BACK!"onClick="history.back();">
Any thoughts
Also I just saw your last post:
If you look at the results of page2.asp
It is in the correct format just need to make it a url output line.
Then I have a routine that will convert the path but I need the url created first.
ASKER
Scott,
Closing this going to open new one for the url issue
thanks
Closing this going to open new one for the url issue
thanks
for each song in arraySongs
response.write "<a href=""&song&"">"&song&"</a>"
next
ASKER
Scott,
Got the url but it is all on one line how do I break <br> the line between each entry
output looks like this
M:\Music\MP3MusicAlbums\ZZ Top\Eliminator\09-Eliminat or-Dirty Dog.mp3 M:\Music\MP3MusicAlbums\ZZ Top\Eliminator\10-Eliminat or-If I Could Only Flag Her Down.mp3 M:\Music\MP3MusicAlbums\ZZ Top\Eliminator\11-Eliminat or-Bad Girl.mp3 M:\Music\MP3MusicAlbums\ZZ Top\Greatest Hits\01-Greatest Hits-Gimme All Your Lovin'.mp3
check the site out
Got the url but it is all on one line how do I break <br> the line between each entry
output looks like this
M:\Music\MP3MusicAlbums\ZZ
check the site out
for each song in arraySongs
response.write "<a href=""&song&"">"&song&"</a><br>"
next
or
response.write "<ul>"
for each song in arraySongs
response.write "<li><a href=""&song&"">"&song&"</a></li>"
next
response.write "</ul>"
If you go the li method, add this to your css
li{list-style:none;}