在Paragraphs中显示mysql内容时出现问题
I insert questions(which might be a few paragraphs) in a sql table using php and than i diplay them on a webpage.
我使用php在sql表中插入问题(可能是几段),而不是在网页上显示它们。
but when i display the question it loses its formatting. I mean it will just show the whole question in one paragraph, even thou there were many paragraphs before.
但当我显示问题时,它会失去格式。我的意思是它只会在一个段落中显示整个问题,即使你之前有很多段落。
<td width=\"700px\" bgcolor=\"#EAD57F\"><font color=\"#4A2A0B\">Question :</font><font color=\"#5E450B\">".$row2['Question']."</font></td>
$row2['Question'] --> is my question that i am getting from my sql table by running the SELECT query.
$ row2 ['问题'] - >是我通过运行SELECT查询从我的sql表中获取的问题。
So if i post something like : a s d f
所以,如果我发布类似的东西:s s d f
into my input box.
进入我的输入框
the output looks like : asdf
输出看起来像:asdf
How should i resolve this?
我该如何解决这个问题?
Best Zeeshan
2 个解决方案
#1
Are you storing them as plain text, or do they contain HTML tags? If they are stored as plain text you should put them in a <pre> tag or something equivalent in order to preserve the spacing. Alternatively, you could do the encoding into HTML, putting in <p> tags and such where necessary, but that is complicated and easy to get wrong.
您是将它们存储为纯文本还是包含HTML标记?如果它们以纯文本形式存储,则应将它们放在
标记或等效内容中以保留间距。或者,您可以将编码转换为HTML,在必要时放入标签等,但这很复杂且容易出错。
更多相关文章
- phpstorm取消自动保存并标识修改的文件为星星标记
- 纯php文件不加结束标记的好处
- JSON解析错误:无法识别的标记'<'处于角度
- hibernate(*.hbm.xml)中新添加的字段被标记为红色(找不到)的解决方法
- 可以访问Stackoverflow的自动建议标记系统吗?
- 使用.after()添加html关闭和打开标记
- 如何使用条件if()使用javascript检索带有指定值的选择标记的xml数
- 使用异步库汇编数据库中的所有标记
- adobeindesign JavaScript XML:如何以编程方式添加XML结构标记?