I am making a registration form and in one part I request the nationality of the person, which is selected from a table in SQL
<p style="text-align:center;"><label><select id="lista" name="Nacionalidad">
<?php
include 'conexion.php';
$consulta = "SELECT CveNacion,Nacionalidad FROM catnacion";
$resultado = $mysqli->query($consulta);
?>
<form action="" method="post" class="form-login">
<?php foreach ($resultado as $opciones) : ?>
<option value="<?php echo $opciones['Nacionalidad'] ?>">
<?php echo $opciones['CveNacion'].' '.substr($opciones['Nacionalidad'],0,15) ?>
</option>
<?php endforeach ?>
</select></label></p>
The problem is that when performing the $consulta = "SELECT CveNacion,Nacionalidad FROM catnacion";
it is displayed as follows:
I would like the first value displayed to be Mexico:
As follows:
I have tried to carry out an ORDER BY starting from the M like this SELECT CveNacion,Nacionalidad FROM catnacion ORDER BY Nacionalidad>"M"
, but it does not do it as I want, is there any way that from the query it shows me that result first or I can do it directly in the form, thank you very much in advance