add tag
PHPNoob
My question is that what is correct way to return table rows as a json from php file to ajax for more manipulation, I have done the process of fetching one row and pushing into another main array and returning that with json_encode.

I am using php 7. If I use this MySQL query like this:

    $result = $connection->query($sql)
    
will it return Json array and can I manipulate it in JavaScript? Is this is the correct way?

**Update**: Now I am running php version 8.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.