By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,368 Members | 717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,368 IT Pros & Developers. It's quick & easy.

Problem with output text

100+
P: 263
Problem with output text

Hi all.

I have this page ASP:


Expand|Select|Wrap|Line Numbers
  1. <!-- #include virtual="/include/conn_mysql.asp"-->
  2.  
  3. <%
  4.  
  5. response.Expires = -1500
  6. response.AddHeader "PRAGMA", "NO-CACHE"
  7. response.AddHeader "CACHE-CONTROL", "PRIVATE"
  8. response.CacheControl = "PRIVATE"
  9.  
  10. session.LCID = 1040
  11.  
  12. strCod = request.querystring("id")
  13.  
  14. strSQL = "SELECT * FROM tbl_1 WHERE id = " & strCod
  15. Set objRs = Server.CreateObject("ADODB.Recordset") 
  16. objRs.Open strSQL, cn 
  17.  
  18. strArticolo = objRs("testo")
  19. strParole = split(strArticolo," ")
  20. intParole = ubound(strParole)
  21. intQuante = cint( intParole / 1.9 ) 
  22. ctind = 0
  23. strTesto = ""
  24.  
  25. %>
  26.  
  27. <!-- code HTML -->
  28.  
  29. <%
  30. for ctInd = 0 to intQuante
  31. strTesto=strTesto & strParole(ctInd) & " "
  32. next
  33. %>
  34.  
  35. <!-- first column -->
  36. <%=strTesto%>
  37.  
  38. <%
  39. strTesto=""
  40. for ctInd = (intQuante + 1) to ubound(strParole)
  41. strTesto = strTesto & strParole(ctInd) & " "
  42. next
  43. %>
  44.  
  45. <!-- second column -->
  46. <%=strTesto%>
  47.  
  48.  
  49. <%
  50.  
  51. objRs.Close
  52. Set objRs = Nothing
  53.  
  54. cn.Close
  55. Set cn = Nothing
  56.  
  57. %>
The output is the text divided on two columns as a image attached in this thread.

My problem is that in the first row of the second column I see formatted text registering in db, for example:

style="font-size: 12pt;">text, text, text....
Can you help me?

Viki
Attached Images
File Type: gif image.gif (14.4 KB, 117 views)
Aug 11 '08 #1
Share this Question
Share on Google+
11 Replies

DrBunchman
Expert 100+
P: 979
Hi Viki,

What exactly do you mean by registering in db? Are unexpected characters being saved in the database or are they being written to the screen?

Dr B
Aug 12 '08 #2

100+
P: 263
Hi Viki,

What exactly do you mean by registering in db? Are unexpected characters being saved in the database or are they being written to the screen?

Dr B
Hi Dr.

Thanks x your reply.

I attach the screenshot with problem.
Attached Images
File Type: jpg Immagine.jpg (20.6 KB, 119 views)
Aug 12 '08 #3

DrBunchman
Expert 100+
P: 979
I don't see any style tags in your example above so presumably it's not being accidentally written to the page from your html/asp code?

Does that mean that you are accidentally storing style information in the database? Can you check the contents of the database to see if this is the case?

Dr B
Aug 12 '08 #4

100+
P: 263
This is one example the text registered in the DB MySQL:

Expand|Select|Wrap|Line Numbers
  1. <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">CHI SONO GLI ANGELI</span></span></strong></p>
  2. <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">&nbsp;</span></span></p>
The text is formatted by the script FCKeditor
Aug 12 '08 #5

DrBunchman
Expert 100+
P: 979
Do you mean that you are storing the formatting information in the database?

Dr B
Aug 13 '08 #6

100+
P: 263
Do you mean that you are storing the formatting information in the database?

Dr B
Sorry I don't understand your answer.
Aug 13 '08 #7

DrBunchman
Expert 100+
P: 979
Sorry Viki, what I mean is: are you storing the style mark up in the database? So rather than just storing values you are actually storing html or css?

Or have i completely misunderstood you!?

Dr B
Aug 14 '08 #8

100+
P: 263
OK.

The text in the row of the database is this:

<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">CHI SONO GLI ANGELI</span></span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">&nbsp;</span></span></p>


Not CSS, Not HTML.
Aug 14 '08 #9

DrBunchman
Expert 100+
P: 979
That is HTML.

The problem is probably all the double quotes that you are storing in the database - remember that these are string delimiters in ASP so when you write them to the screen they will truncate your strings.

If you replace the double quotes with single quotes when you get the data does that help at all? e.g.
Expand|Select|Wrap|Line Numbers
  1. Response,Write Replace(rs("column"), """", "'")
Let me know how it goes,

Dr B
Aug 15 '08 #10

100+
P: 263
Hi Dr, please try this link and see the start of second column:

http://www.pontifex.lazio.it/admin/visualizza.asp?id=98
Aug 18 '08 #11

DrBunchman
Expert 100+
P: 979
I see what you mean.

I think, judging by this post, that FCKEditor might be causing the problem but I've never used it before so I don't know.

Anybody else got any experience with it?

Dr B
Aug 18 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.