Insert MYSQL data into HTML Textarea

Follow the link below, the link will open new page to my demonstration.Insert MYSQL into Textarea

The concept is very easy and the main PHP code is below.


//make an object array
$arrayobj = new ArrayObject();
//connect to database
//check connection
echo "Failed to connect to MySQL:".mysqli_connect_error();

$result=mysqli_query($con,"SELECT * FROM table");



<textarea id="myTextarea" rows="25" cols="25"><?php foreach($arrayobj as $value){
echo $value . "\n";}?>


As you can see connecting to database is as usual. The key is the $arrayobj = new ArrayObject() which make this string into an array and the $arrayobj->append (appends) to that array.