Forums
This topic is locked
using only part of data
Posted 13 Sep 2004 20:10:05
1
has voted
13 Sep 2004 20:10:05 colin hart posted:
I have a form field that is called MLSNum, well this MLSNum field also is how images are stored on our FTP Server. I have created a page that shows the image name which is simply <%=(rsPropSearch.Fields.Item("MLSNum".Value)%>.jpg. Problem is the data structure recently changed on how I get these pictures. it use to be in just one huge directory so it was easy, now they store the pictures in subdirectories. They have directories that look like this, 00,01, 02, 03, 04, 05,all the way to 99. They take the last two numbers in the MLSNum field if the MLSNum is S123456, then that image would be under the 56 subdirectory. My old path would look like thiswww.somesite.com/images/<%=(rsPropSearch.Fields.Item("MLSNum".Value)%>.jpg, now I need it put the last two numbers in the path so if the MLSNum was 56 it would look like this
www.somesite.com/images/56/S123456.jpg
how so I make my SQL database only spit out the last 2 numbers in that field?
I am using Macromedia, sql2000 and asp, vbscript
thanks in advance
Replies
Replied 13 Sep 2004 22:54:17
13 Sep 2004 22:54:17 Rene Bandsma replied:
Something like this:
<pre id=code><font face=courier size=2 id=code>
Dim strURL, strDir
'declare your URL
strURL= <%=(rsPropSearch.Fields.Item("MLSNum".Value)%>.
'set strDir as the last two numbers
strDir= Right(strURL,2)
'write the URL on the screen
Response.Write "www.somesite.com/images/" & strDir & "/" & strURL
</font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code>
Dim strURL, strDir
'declare your URL
strURL= <%=(rsPropSearch.Fields.Item("MLSNum".Value)%>.
'set strDir as the last two numbers
strDir= Right(strURL,2)
'write the URL on the screen
Response.Write "www.somesite.com/images/" & strDir & "/" & strURL
</font id=code></pre id=code>