|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Comma Replacing
PHP Code:
I have the above code... the output is rows from the DB as wxpected, but the entries are: ,one,two,three,four and so on, How do I get rid of the commas? Janusz |
|
#2
|
||||
|
||||
|
you can do it 2 different ways
Code:
values = rs("fieldName")
Response.write(removeCommas(values))
Function removeCommas(value)
value = Replace(value, ",", "")
removeCommas = value
End Function
Or Code:
dbValues = rs("fieldName")
values = Split(dbValues, ",")
For i = 0 To UBound(values)
Response.write(values(i) & "<br>")
Next
|
|
#3
|
|||
|
|||
|
ok
cool...
but where in the original code would it go - newbie alert! Janusz |
|
#4
|
|||
|
|||
|
Well...
PHP Code:
I have the above for retrieving the row for the current user - how can I implement a loop in there so it'll go through all members? TIA |
|
#5
|
||||
|
||||
|
you can combine them and do this
Code:
<%If NOT IsNull(Links2) THEN
Response.write(splitValues(RS("Links")))
Response.write(splitValues(RS("BookTitle")))
Response.write(splitValues(RS("BookDescription")))
%>
Function splitValues(value)
values = Split(value, ",")
For i = 0 To UBound(values)
newValues = newValues & values(i) & "<br>"
Next
splitValues = newValues
End Function
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Comma Replacing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|