This topic is locked
[SOLVED]

 How to copy all list of data of a json response?

7/26/2020 5:30:20 AM
PHPRunner General questions
K
Kervee author

Hi Guys,
I am trying to copy a list of reponse from a Rest API request into a mysql table, and it seems that my code is copying only 1 row, but I need all the 300 rows of data to be copied to the table, I have attached the image of my full code below
can someone please help me because I'm stuck with my project and can't move on, thanks

Sergey Kornilov admin 7/26/2020

$response variable holds the whole JSON response.

K
Kervee author 7/26/2020



$response variable holds the whole JSON response.


Hi Sir,
Yes I agree, but how can I put them all into a table, based on my code, I can only add one row,
do I need to use 'foreach' function to make it work? or is the [0] that I put is necessary?
can you share some example code please?
many thanks,

Kervee

fhumanes 7/26/2020

Hello:
It doesn't fit your question but it does fit the functionality.
https://asprunner.com/forums/topic/27323-phprunner-app-with-restful-api/
In this example I show how the response is loaded into a Mysql table.
Greetings,
fernando