Read the mysql and display the value on the text box

I have the following coding and want to display the value of "ChannelName" on textbox 1. I have attached the blocks here. Please tell me how to fix it.

<?php
include './config2.php';

$sql = "SELECT *
		FROM InternetRadio_Link
		WHERE ChannelNo IS NOT NULL
		ORDER BY ChannelNo";

$result = $pdo->query($sql);


foreach($result as $row) {
		echo $row["id"],$row["ChannelNo"],$row["ChannelCounty"],$row["ChannelName"],$row["ChannelURL"],$row["ChannelPlayPic"];
	}
?>

Please show your response content, preferably as text

The result on my mobile as attached.

The result of executing the MySQL;

11Germanyrbb Fritz - Berlin 102.6 FMhttp://fritz.de/livemp3http://8.192.62.65/booked/InternetRadio/Germany.png22FranceRadio France Culturehttp://icecast.radiofrance.fr/franceculture-midfi.mp3http://8.192.62.65/booked/InternetRadio/France.png33United StatesWFDU Retro Radio 89.1 FM - Teaneck, NJhttp://peridot.streamguys1.com:5350/ihearthttp://8.192.62.65/booked/InternetRadio/UnitedStates.jpg44AustraliaORF oe1campushttp://orf-live.ors-shoutcast.at/campus-q2ahttp://8.192.62.65/booked/InternetRadio/Australia.jpg55United KingdomCapital London 95.8 FMhttps://media-ice.musicradio.com/CapitalMP3http://8.192.62.65/booked/InternetRadio/UnitedKingdom.jpg66ThailandVoice from the Navy, FM 88.5 Sor.Tor.1, Wangnanthayuthayahttp://radio12.plathong.net/7346/;stream.mp3http://8.192.62.65/booked/InternetRadio/Thailand.png117SingaporeOne FM 91.3 - Singaporehttps://playerservices.streamtheworld.com/api/livestream-redirect/ONE_FM_913.mp3?dist=worldradiomaphttp://8.192.62.65/booked/InternetRadio/Singapore.jpg128ItalySimply Italia Radio - Lazio 93.1https://stream4.xdevel.com/audio1s975968-807/stream/icecast.audiohttp://8.192.62.65/booked/InternetRadio/Italy.png139PhilippinesPhilippine Broadcasting Service (PBS)https://stream.zeno.fm/qnt98p5m108uvhttp://8.192.62.65/booked/InternetRadio/Philippines.jpg1410MalaysiaBFM 89.9 - Kuala Lumpurhttp://playerservices.streamtheworld.com/api/livestream-redirect/BFM.mp3http://8.192.62.65/booked/InternetRadio/Malaysia.jpg

Doesn't look like a dictionary, just a list of URLs. You would need to use text manipulation to extract the channel names if you can . May be better to look at your query again...

May I know if you have any examples for me to follow?

You need to check your query, it does not appear to be returning the data you are requesting....

Thank you very much. I have reworked it again, but it still does not work.



jsonformatter.txt (3.8 KB)

OK, that is a good looking json response, just need to parse it correctly now....

If you a still struggling to ouput the data, see here:

I actually changed the display method, so I want to use the dynamic component to show the list. But I got the following error. Can you please tell me how to fix it?


What is the content of Channel2.json ?

please find the json file attached.

Channel2.json (3.8 KB)

Just looking at your blocks again, you probably should use:

image

here

otherwise you are making a list, not a dictionary

Try this for starters:

getCh2.aia (3.3 KB)

Thank you very much, and I learned a lot from you. However, if I want to display a flag of each country and its channel name (see attached). Each country flag is in the exact location "http://8.192.62.65/booked/InternetRadio/country.png" where the country name is referred by JSON file "ChannelCounty". When clicking the respective country flag, it will play the song and the URL of the song is in the JSON file "ChannelURL". How can I do that?

image

The screen is according to the "aia" file you provided.

Try this

getCh2v2.aia (41.5 KB)

I had to use a flags extension, because your urls are inaccessible (local?)

yes, you are right. I have configured the firewall, so you can access them in the new json file.

i.e http://hss-internetradio.servehttp.com/booked/InternetRadio/country.png

Channel2.json (4.2 KB)

Finally, I can load the country flags and play their radio respectively. But the App responds a bit slowly. May I know what I can improve it?
getCh2.aia (38.0 KB)

It is slow because of the time it takes to get all of the images (even though they are small in size). Just remove the image block and replace it with an empty test block, you will see the difference.

Might be better to download the images to the device on first run, then load them to the list view from the local files. (or get all the images and upload them to the media folder - assets - in the app)

I have completely reworked it (gone back to AI2 lists), and loaded images to the assets.

There is still a delay while the player get the radio source, but i used a notifier progress dialog to help with that.

Two of your stations; Philippines and Italy do not work with the player, so I have removed those from your json.

getCh2Slow2.aia (97.7 KB)

Thank you for your kind assistance, please allow me to study from your working again.

If you haven't yet noticed, there is a Country.json file at

with flag emojis.

That should help speed up lookups, since it's all local.