I have an file application that works for some data but not other?? The
error I'm getting causes an error on line 64 
for (reset($t1); $ti=current($tl)
any thoughts??
<?php

include "npdata.php";
include "mapfuncs.php";
global $connID, $opid, $nextpage;

        $li = get_complete_lot_info($lot);
        $ops = implode($li['ops'], ",");

        // To by pass a lot of unnecessary questioning of the operator
        // (which run? which operation? fixtures? pallets?  yada yada
        // yada... I am going to pull the first operation that is identified
        // as being run on newport equipment in templateops.  Then check
        // sys_loads for load information, then scam the stuff from the
        // newport database

        if (empty($opid)) {
                $sql = "SELECT op.Operation_ID FROM operations AS op ";
                $sql .= "INNER JOIN runs AS r ON (op.Run_ID = r.Run_ID) ";
                $sql .= "INNER JOIN templateops AS top ON (r.Type =
top.Test_Code) ";
                $sql .= "AND (top.Operation = op.Operation) ";
                $sql .= "WHERE op.Operation_ID IN ($ops) AND top.Equip =
'NP' ORDER BY op.Operation_ID;";

                $res = mysql_query($sql);
                $op = (mysql_num_rows($res)? mysql_result($res, 0, 0): 0);
        } else {
                $opid = intval($opid);
                $opid = ((empty($opid) || ($opid<0))? 0: $opid);
                $op = ($opid? $li['ops'][$opid-1]: 0);
        }


        if ($op) {
                $sql = "SELECT System, Fixture, Positions, Pallet, Dev_ndx,
0 AS Test_list FROM sys_loads WHERE Operation_ID=$op;";
                $res = mysql_query($sql);
                if (mysql_num_rows($res)) {
                        while ($obj = mysql_fetch_object($res)) {
                                $loads[] = $obj;
                        }
                        // All devices should be loaded in the same
system...
                        $sysid = $loads[0]->System;
                        $connID = connect_to_np_system($sysid);
                        // get list of steps for the ENTIRE lot (used to be
just one run)
                        $sql = "SELECT s.Step_ID, s.Step, s.Params ";
                        $sql .= "FROM runs AS r INNER JOIN operations AS op
ON (r.Run_ID = op.Run_ID) ";
                        $sql .= "INNER JOIN steps AS s ON (op.Operation_ID =
s.Operation_ID) ";
                        $sql .= "WHERE r.Lot_ID = '$lot' ORDER BY
s.Step_ID;";
                        $res = mysql_query($sql);
                        if (mysql_num_rows($res)) {
                                while ($obj = mysql_fetch_object($res)) {
                                        $steps[] = $obj;
                                }
                                for (reset($steps); $step=current($steps);
next($steps)) { 
                                        $p = explode(",", $step->Params);
                                        $name = $p[count($p)-1];
                                        // echo "ID: $step->Step_ID, Name:
$name<br>\n";
                                        $list1[] = "<option
value='$step->Step_ID'>$step->Step_ID. $name</option>";
                                }
                                for ($i=0; $i<count($loads); $i++) {
                                        // Get tests for each load in
'Newport' operation...
                                        $list2 = array();
                                        $load = $loads[$i];
                                        $tl =
get_tests_by_fixture($load->Fixture, $lot);
                        for (reset($tl); $ti=current($tl); next($tl)) {
                                                $ttype = ($ti[2]==0?
"(LIV)": "(Burn-in)");
                                                $list2[] = "<option
value='$ti[0]-$ti[1]'>$ti[0]-$ti[1] $ti[3] $ttype</option>";
                                        }
                                        $loads[$i]->Test_list = $list2;
                                }
                                echo "<table><tr><td
width='120'>&nbsp;</td><td>";
                                echo "<form name='frmTests'
action='main.php' method='post'>\n";
                                echo "<input type='hidden' name='page'
value='$nextpage'>\n";
                                echo "<input type='hidden' name='lot'
value='$lot'>\n";
                                echo "<input type='hidden' name='sysid'
value='$sysid'>\n";
                                echo "<input type='hidden' name='op'
value='$op'>\n";
                                echo "<table cellspacing='3' cellpadding='3'
border='0'>\n";
                                echo "<tr><td>Import Step:</td><td
colspan='3'><select name='step'>\n";
                                echo implode($list1, "\n");
                                echo "</td></tr>\n";

                                echo "<tr><td class='thdr'>Slot</td><td
class='thdr'>Pallet</td>";
                                echo "<td class='thdr'>Test(s)</td></tr>\n";
                                $ptr=1;
                                for (reset($loads); $load=current($loads);
next($loads)) {
                                        echo
"<tr><td>$load->Fixture</td>\n";
                                        echo "<td>$load->Pallet</td>\n";
                                        $nm = "tl" . $ptr++ . "[]";
                                        echo "<td><select name='$nm'
multiple>\n";
                                        echo implode($load->Test_list,
"\n");
                                        echo "</td></tr>\n";
                                }
                                echo "<tr><td>&nbsp;</td><td
colspan='2'><input type='submit' value='Ok'></td></tr>\n";
                                echo "</table>\n</form>\n";
                                echo "</td></tr></table>\n";
                                trav_set_focus('frmTests', 'step');



                        } else {
                                // No steps associated with lot.  HUH?
                                // Major error...


                        }
                } else {
                        // no newport operation loaded in sys_load

                }
        } else {
                // No newport operation available, shouldn't be trying to
import
                // from newport anyway...

        }
                        
Peter Silbermann
Tyco Electronics Inc.
Fiber Optic Buisness Unit
Active Products Group
Device Validation
908-704-3303 (Work)
610-570-2185 (Mobile)
[EMAIL PROTECTED] 

?>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to