Runtime Error *empty-string*, The second argument to foreach is not a list

[Runtime Error empty-string, The second argument to foreach is not a list.

Hello I confirm the error is concerning this block, and with .json file
can anyone solve it for me? I tried so many ways including amend .php files
so that i also attached it content of .json file here
is it about the .php file version or other things?

<?php header("Content-Type: text/html; charset=utf-8"); include("connsql.php"); $seldb = @mysqli_select_db("orderdrink"); if (!$seldb) die("dead"); $sql = "select * from product"; $result = mysql_query($sql); $json = array(); if(mysql_num_rows($result)){ while($obj=mysql_fetch_object($result)){ $json[]=$obj; } } echo json_encode($json); ?>

the following is another .php file for login to database

.consql.php as follows:

<?php $db_host = "localhost"; $db_username = "duser"; $db_password = "abcde"; $db_name = "id15760476_orderdrink"; $db_link = @mysqli_connect($db_host, $db_username, $db_password, $db_name); if (!$db_link) die("unsuccessful!"); ?>

thank you

Hi @111328 Welcome to Community
Print response content on a label and show what you get.

Please see

for samples of what JSON text looks like, and
compare that to your responseContent text value.

sorry , i didn't exactly get your meaning, how to print response content?

image

I just can add comment by this method, it doesn't show anything inside the box

to get a result in the Web.GotText event you obviously first have to use the Web.Get or Web.Post method...

use Do it to debug your blocks, see also tip 4 here https://puravidaapps.com/learn.php
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

sorry, I cannot troubleshoot the problem even after I spend a lot of time to amend the .json file and other related .php file, so that I decided to upload the .aia and related files here,
please kindly help to solve the problem

I tried so many times with days to days but just cannot solve
json.php
question.aia (2.0 KB)

what value should I enter in it?

as already said

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

proj_poscloud2.aia (219.1 KB)

Please kindly find the .aia file attached, for .json file here

thank you very much for help, as i don't know how to do bug hunting..........