简体   繁体   中英

Not getting all rows from a query with odbc_exec in php

I'm trying to display how many id's does my procedure finds, but the variable $processz only got the first row of the sql result. It should display that there are 17 rows or id's, and only got 1. Why does it happends?

  $conexion = con_abrir();

  $sqlquery = "OEE.dbo.VerPlanillas_fechas '$Linea_ID','$fecha1','$fecha2'";
  $processz = odbc_exec($conexion,$sqlquery);

  con_cerrar($conexion); 

  $res = count($processz);
  echo $res;

count ($processz) tells you how many results you have - one.

If you want to know how many rows are in the result, you need to call odbc_num_rows ($processz);

Look into using PDO rather than odbc specific functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM