Separate content from Response Content

Does anyone here have an idea how to separate content from response content? Like for example in the image below, there are 2 contents from response content and I want to insert those content from different card. I tried split component but it doesn’t work.

This is the blocks btw:


Thanks in advance! :blush:

Where did you store such informations?? Any database?

yup in mysql database

Why don’t you filter there itself so that you can get such result … Using query method.

Your php script is returning 2 records separated by || ?
And does this content have html tags?

1 Like

yes, this is actually my code for that:

$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='$Tk_SchTime' AND Bus_Branch='$Tk_SchBranch'");

while ($result=mysqli_fetch_array($data))
{
    
    echo "<strong>Plate Number</strong> | ";
	echo $result["Bus_Plate_Number"];
	echo "<br>";
	echo "<strong>Class</strong> | ";
	echo $result["Bus_Class"];
	echo "<br>";
	echo "<strong>Departure Time</strong> | ";
	echo $result["Bus_Dep_Time"];
	echo "<br>";
	echo "<strong>Arrival Time</strong> | ";
	echo $result["Bus_Arriv_Time"];
	echo "<br>";
	echo "<strong>Driver</strong> | ";
	echo $result["Bus_Driver"];
	echo "<br>";
	echo "||";
}

To return the data , vice DO NOT need this html , you only need the variables

2 Likes

what do you mean?

First :
:point_down:
You need Read about Json in PHP
Second
:point_down:

3 Likes

I guess I have to learn that JSON first lol

1 Like

then after that, I can finally separate that 2 records?

  1. I suggest you to use fetch_assoc() instead of fetch_array().
  2. Encode your returned data into JSON
  3. Parsing JSON in your App
2 Likes

Try…
But
in the PHP script, you need to change more things… search on json_encode and array , for you to return Json and with this return you will use Kodular blocks more easily ( dictionary or lookup pairs Key )

2 Likes

Yes, This would be the best one if you are getting multiple contents from your php. You can search in community. Already plenty of suggestions are there.

1 Like

Okay, thanks guys!

Why did you make your code that way?

because I thought it would work. lol

Hey again guys!
I’ve been fixing this error since yesterday and until now I can’t still fix it.

I already checked the response by printing it in a label (as you can see behind that notif) and I still don’t know why it gets error.
This is my blocks:



Here is the response from label:

1-Your php return is right?
2- Click and DO IT on the blue block “list of pairs to …”

What do you get as a result?

3- Click on DO IT in the blocks below: Get Value for Key…