Empty an array in while

0

I have the following problem, in an arrangement that I fill in another page I have names of fields of a bd, what I want is to make a query select but with the fields of my arrangement

Here I bring the fields of the bd that I choose on the previous page and print them, here I have no problems

foreach($_POST['opciones'] as $color){
        echo $color."<br>"; };

This does not work for me, in name1 is the table and name2 the fields

$nombre1 = $_SESSION["bd"];
$nombre2 = $_POST['opciones'];
$res = $mysqli->query("SELECT * FROM $nombre1 ");

    $f = array();
    while($f = $res->fetch_array($nombre2)){

    echo $f[0] ;
}
    
asked by Andre 18.12.2017 в 17:21
source

0 answers