<textarea>和MYSQL在php中显示数据
问题描述:
好的,所以当我尝试使用 MYSQL 查询和 <textarea>
显示数据时,它崩溃了并且无法运行.它在没有文本区域的情况下运行良好(但并非所有数据都适合文本框).
OK so when I try to display data using a MYSQL query and a <textarea>
it crashed and dose not run.
It works well without text area (but not all the data fits in the text box).
下面是代码.
while($row = mysql_fetch_array($result_reviews))
{
echo "<td>" .$row['username']. "</td>";
echo "<td>" .$row['title']. "</td>";
//echo "<td>" .$row['review']. "</td>";
echo "<td><textarea rows="8" cols="50">" .$row['review']. "</textarea></td>";
echo ("<td><a href=\"editreview.php?id=$row[id]\">
<button>Edit Review</button></a></td>");
echo ("<td><a href=\"delete.php?id=$row[id]\">
<button>Deleat Review</button></a></td></tr>");
}
我需要 textarea,因为我希望输出可能很长的评论.我已经查看了有关此问题的其他一些答案,但似乎没有用.
I need textarea as there is a review I wish to output that can be quite long. I have looked at some of the others answers for this problem and non seem to work.
答
可能与双引号冲突.试试
Maybe a conflict with double quote. Try
echo "<td><textarea rows=\"8\" cols=\"50\">" .$row['review']. "</textarea></td>";
或
echo '<td><textarea rows="8" cols="50">' .$row['review']. '</textarea></td>';