1

I want to display data from mysql into ckeditor field using angularjs, it works. But the only problem is the array also displayed (can refer here)

Array ( [0] => Array ( [qterm] =>This paragraph only.) ) 

here is my coding.

index.html

<textarea name="editor1" class="ckeditor" id="editor1" ng-model="tnc"></textarea>

myApp.js

var app=angular.module('myApp',[]);
app.controller('cntrl', function($scope,$http) {

    function getTerm() {
        $http.get("qterm.php").success(function(data) {
            $scope.tnc = data;
        });
    };
    getTerm();
});

qterm.php

<?php
include('../config.php');
$query="select qterm from configuration";
$data = array();
$rs=$connect->query($query);

while ($result = mysqli_fetch_assoc($rs)) {
    $data[] = $result;
}

print_r($data);
//print json_encode($data);
?>

What should I do? Thanks for reading.

1 Answer 1

1
$output = print_r($data, true);
echo $output;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.