当前位置: 动力学知识库 > 问答 > 编程问答 >

php - display data in textarea

问题描述:

hello i have a table that has column send and column answer, like this :

http://gyazo.com/3ab5445f8bab390834b9c0dfc2e5219f

what i want to do is to display them in textarea like this :

gyazo.com/c4d3b561577cb6476fd2cf0e792e30ec

this is my code

<?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>

and this is the result i get from it :

gyazo.com/72506891250fa9df6ff328316416fc5d

thanks for the help !!

分享给朋友:
您可能感兴趣的文章:
随机阅读: