Jump to content

imprint

New Members
  • Posts

    2
  • Joined

  • Last visited

imprint's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ch0cu3r, that is what I was thinking and was trying to see if I was on the right path, thanks! cyberRobot, DOH! I can't believe I didn't think of that. So simple and will speed things up as well.
  2. I have the following code which prints results from a sqlsrv_fetch_array() using a while loop. For one segment, however, I only need the first $value of the $key=>$value pair, and obviously with the code written this way it returns all rows. I have an idea of an approach, and I'm wondering if I'm headed in the right direction or if anyone has experience with this that they can share. So, during the while loop, I am pushing the elements of the sqlsrv_fetch_array() into a separate array. So I see two potential options: 1. Print from the $actcontacts[] array rather than from the sqlsrv fetch array. 2. During the while loop, rather than pushing anything into a new array, build a conditional that says to only print the record if $row['ENDTIME'] is in position $row[0]. I'm leaning toward #2, but I'm not quite sure how to get there...and if there is a better way under door #3, I would like to try that. while ($row = sqlsrv_fetch_array( $stmt_act, SQLSRV_FETCH_ASSOC) ) { $actcontacts[] = "N/A" . "," . $row['COMPANYNAME'] . "," . $row['CITY'] . "," . $row['STATE'] . "," . $row['CUST_Salesman_124705300'] . "," . $row['ENDTIME'] . "," . "ACT"; // I have done a print_r() on $actcontacts and the data is correct. $endtime[] = $row['ENDTIME']; echo "<tr>"; echo "<td>" . "<i>N/A</i>" . "</td>"; echo "<td>" . $row['COMPANYNAME'] . "</td>"; echo "<td>" . $row['CITY'] . "</td>"; echo "<td>" . $row['STATE'] . "</td>"; echo "<td>" . $row['CUST_Salesman_124705300'] . "</td>"; echo "<td>" . $row['ENDTIME'] . "</td>"; // This is the bugger that is printing eleventy records. It may be one customer, but there are always multiple contact/history entries. echo "<td>" . "ACT" . "</td>"; echo "</tr>"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.