0
What I’m trying to do is select all members of the member table that have the Lider name in the "member" column display in select sorted by name.
<div class="form-group">
<label for="selector1" class="col-sm-2 control-label">Líder</label>
<div class="col-sm-8">
<select name="lider" id="lider" class="form-control1">
<option value="SEM CÉLULA">SEM CÉLULA</option>
<?php
require_once("../cfg/base.php");
$db=get_db();
$stmt = $db-> prepare( 'SELECT membro, nome FROM membros WHERE membro = "Lider" ORDER BY nome' );
$stmt-> execute();
$result = $stmt-> fetchAll( PDO::FETCH_ASSOC );
?>
<?php foreach( $result as $row ) { ?>
<option value="<?php echo $row['nome'];?>"><?php echo $row['nome'];?></option>
<?php } ?>
OK but what is the problem that is giving?
– Anderson Henrique
Does not display in select the people who have Leader in the member column of the member table
– Leonardo Ribeiro
but are returning from the bank?
– Anderson Henrique
I didn’t try to show it any other way and it’s not happening
– Leonardo Ribeiro
From a print_r($result); and see if it shows something, tell me if it shows
– Anderson Henrique
Array ( [0] => Array ( [member] => Leader [name] => Leonardo ) )
– Leonardo Ribeiro
ok here in this part do so <?php foreach( $result as $Row ) { ? > <option value="<? php echo $Row[0]['name'];? >"><? php echo $Row['name'];? ></option> <?php } ? > If it works please tell me to put as a thank you reply
– Anderson Henrique
It worked bro, thanks... put it there !
– Leonardo Ribeiro
you could help me with one of my birthday kids?
– Leonardo Ribeiro
I can, but how so?
– Anderson Henrique
is that I have no idea how to do...
– Leonardo Ribeiro
Let’s go continue this discussion in chat.
– Anderson Henrique
gave error that last code :(
– Leonardo Ribeiro