ListPicker is not showing data

Sir I am using first time ListPicker

My PHP file is like this


<?php
date_default_timezone_set("Asia/Karachi");
$servername = "localhost";
$username = "id20649282_hassan";
$password = "Tariq@123456";
$database = "id20649282_asiacng";

$dbc = mysqli_connect($servername, $username, $password, $database);

if (!$dbc)
{
    die("DATABASE CONNECTION FAILED:" . mysqli_error($dbc));
    exit();
}

$button = mysqli_real_escape_string($dbc, $_GET["button"]);

if ($button == "btn_Get")
{

    $query = "select * from world";

    if ($result=mysqli_query($dbc, $query))
    {

       /*
        while ($row = mysqli_fetch_array($result))
            {
                echo $row['country'];
                echo "<br>";
          }
          */
      

        $numColumns = mysqli_field_count($dbc);

        if ($numColumns > 0)
        {
    
            $en_csv = '';
            while ($row = mysqli_fetch_assoc($hacer))
            {
                foreach ($row as $column)
                {
                    $en_csv .= $column . ",";
                }
                $en_csv = rtrim($en_csv, ",");
                $en_csv .= "\n";
            }
            $en_csv = rtrim($en_csv, "\n");

            print $en_csv;
        }

    }
    else
    {
        echo "ERROR: Could not able to execute" . $query . " " . mysqli_error($dbc);
        exit();
    }

    mysqli_close($dbc);
    exit();
}

?>

and here are blocks

When I click Get Data button then it shows responsecode=200 like this

but ListPicker is not showing data

t_ListView_with_Mysql.aia (3.2 KB)

Please help

Set list picker.text to response content

Sir now it is showing blank list.
I think responseContent is empty, when responseCode is 200 then why responseContenct is empty?

Please help

Something wrong with your php file, no response content returned, can't even get back the error message. Doesn't return anything in a computer browser, either.

What is $hacer?

Sir I added these codes in php

   while ($row = mysqli_fetch_array($result))
            {
                echo $row['country']."\n";
                echo '<br>';
          }
        

Now ListPicker is showing data like this

I think there is another issue.

Regards

  1. You don't need to echo that <br>
  2. Data coming back as a list of lists e.g. [[Afganistan],[Banglasdesh],[Belarus]...], so you will need to flatten the list of lists for display/selection in the listpicker

Sir this time I have these blocks

ListPicker is also showing data

But I want to display data like this

Select Country: Afghanistan
Dialing Code: 93

Please

Your list item contains country code,country name

You can use split text at , block from text blocks then select first item for country code and second item for country name and show it in the layout.

Sir I used this block for splitting but it shows data like this

Please

Put , (comma) in at block

1 Like

Sir I used this block

The result is

But I need only Afghanistan in ListPicker after selection.

t_ListView_with_Mysql (1).aia (3.6 KB)

Regards

Try this. And also uncheck show lists as json checkbox in screen1 properties.

:question:

1 Like

This should work:

1 Like

Sir now I have these blocks

Data is showing in ListPicker like this

but when I select any item from ListPicker then this message appears

t_ListView_with_Mysql (2).aia (4.0 KB)

Please

As @ABG shows you need to follow the blocks I provided, SelectionIndex, NOT Selection

Thanks sir it works fine now,
I have a little more request.
I want to apply Filter on this ListPicker so I checked this box

filter

But filter is not appear on ListPicker.
How to apply Incremental search?

Please help

  1. Change your aia project's theme to Device Default - the filterbar text will then display correctly for the listpicker

  2. Use these new blocks to set your selection to the button and textbox (I have changed the listpicker to only show countries...., I also had to reverse each sublist - code,country to country,code - in order to use look up in pairs, because filtering the listpicker changes all the indexes)