PHP - MySQL results to JSON -


I am trying to convert a MySQL result to a JSON format so that I can later use this JSON Javascript to create an HTML table. Although my code produces very nil values ​​and why I am still not understood.

  $ result = mysqli_query ($ con, "select from clients"); $ test = json_encode ($ result); Print $ test; Output:  
  {"current_field": null, "field_count": zero, "length": blank, "num_rows": empty, "type ": null}   

I have fields like, for example," customer ID "and" name ", and even they do not even appear in JSON results.

What am I doing wrong? Thanks

  $ result = mysqli_query ($ con, "select from customers"); While ($ line = mysqli_fetch_assoc ($ result)) $ test [] = $ line; Print json_encode ($ test);    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -