你好,我有一个包含列发送和列回答的表,如下所示: http://gyazo.com/3ab5445f8bab390834b9c0dfc2e5219f
我想要做的是在textarea中显示它们,如下所示: gyazo.com/c4d3b561577cb6476fd2cf0e792e30ec
这是我的代码
<?php
include 'core/init.php';
$name=$user_data['first_name'];
$name=htmlentities(strip_tags(mysql_real_escape_string($name)));
$query= mysql_query("SELECT `send`, `answer` FROM messages WHERE user ='$name'");
$finalRes = array();
if(!$query) {
var_export(mysql_error());
}
while($result = mysql_fetch_assoc($query))
{
$finalRes[] = $result;
}
if (!empty($finalRes)){
foreach ($finalRes as $URL){
echo "<font color='green'>you </font>".$URL['send']."";
echo "<br>";
echo "<font color='red'>admin </font> ".$URL['answer']."";
echo "<br>";
}
}
?>
<textarea > </textarea>
这是我得到的结果:
gyazo.com/72506891250fa9df6ff328316416fc5d
感谢您的帮助!!