简体   繁体   English

<textarea>和MYSQL在PHP中显示数据

[英]<textarea> and MYSQL to display data in php

OK so when I try to display data using a MYSQL query and a <textarea> it crashed and dose not run. 好的,所以当我尝试使用MYSQL查询和<textarea>显示数据时,它崩溃了并且无法运行。 It works well without text area (but not all the data fits in the text box). 它在没有文本区域的情况下效果很好(但并非所有数据都适合文本框)。

bellow is the code. 波纹管是代码。

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>");
        }

I need textarea as there is a review I wish to output that can be quite long. 我需要textarea,因为我希望输出的评论可能会很长。 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>";

OR 要么

echo '<td><textarea rows="8" cols="50">' .$row['review']. '</textarea></td>';

如果要使其“不可编辑”,则可以使用“ readonly”属性。

<textarea readonly>

也许您可以将div与“ overflow-x:scroll”一起使用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM