Concatenate WHILE

-3

How can I concatenate a while to put into an array. How to make this piece of code work?

$nestedData[] = $row["nomerota"];

                $tr="<select size='1'>";
                $tr.= while ($row = mysqli_fetch_array($resultado)) 
                {
                <option value='$row['nome'];'>$row['nome'];</option>                         
                }
                $tr.="</select>";

$nestedData[] = $tr;

My problem is here:

$tr.= while ($row = mysqli_fetch_array($resultado)) 
            {
            <option value='$row['nome'];'>$row['nome'];</option>                         
            }
    
asked by anonymous 20.03.2018 / 01:46

1 answer

0

I think you want something like this:

$nestedData[] = $row["nomerota"];
$tr="<select size='1'>";
while ($row = mysqli_fetch_array($resultado)) {
    $tr.= "<option value='$row['nome'];'>$row['nome'];</option>"                         
}
$tr.="</select>";
$nestedData[] = $tr;

You should not concatenate while , but rather the text and variables that are in

    
20.03.2018 / 01:58