php - sqlsrv_fetch_object() not returning results -


i have simple select statement, optional clause, , order while looping through sqlsrv_fetch_object() not getting records:

if (!$conn)  {     echo "no connection!\n"; } $data = array(); $qry = "select distinct lineid, ord_num, prod_num, description, prod_type, style, color, sizetype, qty1, qty2, qty3, qty4, qty5, qty6, qty7, qty8, qty9, qty10, qty11, qty12, qty13, qty14, qty15, ext_id, decoration1, design1, iposition1, cccode1, decoration2, design2, iposition2, cccode2, decoration3, design3, iposition3, cccode3, '', design4, iposition4, cccode4, decoration5, design5, iposition5, cccode5, decoration6, design6, iposition6, cccode6, decoration7, design7, iposition7, cccode7, last_mod datalive.dbo.sodetail "; if ($last_run_date) {     $qry .= "where last_mod > '" . $last_run_date . "' ";  } $qry .= "order last_mod asc"; fwrite($fp, $qry . "\n");  if ($st = sqlsrv_query($conn, $qry)) {      while ($row = sqlsrv_fetch_object($st))     {         $row->last_mod      = $row->last_mod->format('y-m-d h:i:s');         fwrite($fp, "last mod::: " . $row->last_mod . "\n");         $data[]     = $row;     }     sqlsrv_free_stmt($st);     unset($row, $st); } else  {     $sqlerr = sqlsrv_errors();     foreach ($sqlerr $key)     {         foreach ($key $col => $val)         {             echo "error key: " . $col . "\nerror msg: " . $val . "\n";             fwrite($fp, "error key: " . $col . "\nerror msg: " . $val . "\n");         }     }      $data = false; } return $data; 

i don't know why sqlsrv_fetch_object() not returning anything. also, can copy , paste query directly sql server studio log i'm writing, parses fine. there nothing in log file writing out last_mod date in while loop.

i posted different question few minutes ago , suggested remove selection of empty string in select statement, need empty string placeholder there is.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -