PHP client data list in JSON

Asked

Viewed 266 times

2

Good afternoon, you guys,

well I have a CRUD in PHP and need to have registered clients shown in another JSON URL

But I eat I’m a little weak in PHP I have no idea how to do this with data coming from a BD query, someone has knowledge of how to do?

  • 1

    Puts the code in question, to see if anything can be done.

1 answer

1

Assuming the data you brought from BD is in an array or object called $data just use the function json_encode, the code would look something like this:

// código para obter os dados do BD
echo json_encode($data);

More details about json_encode function here: http://php.net/manual/en/function.json-encode.php

  • Putz, and I thought it was something much more complicated. Thanks!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.