Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/04/2019, 23:12
aams01
 
Fecha de Ingreso: marzo-2011
Ubicación: Parral
Mensajes: 20
Antigüedad: 13 años
Puntos: 0
Respuesta: No carga primer dato

Puedes agregar un simple contador o usar la función para ello
Código PHP:
Ver original
  1. <?php  
  2. include('conexion.php');  
  3. $soc = $_POST['soc'];  
  4. $query="SELECT cod_hor,horario from horario where cod_hor='$soc'";  
  5. $result=$mysqli->query($query);  
  6.    $row_cnt = mysqli_num_rows($result);  // es te método es méjor
  7. $html = "<option value=''>Seleccionar</option>";  
  8.        $num=0;
  9. while (($fila = mysqli_fetch_array($result)) != NULL) {  
  10. $num++;
  11. $html.= "<option value='".$fila['cod_hor']."'>".$fila['horario']."</option>";  
  12. }  
  13. echo $html ;
  14. echo $num;
  15. echo    $row_cnt;
  16. ?>