function is4cTestAndDie($dbConn2) { global $dieMail; $selectIs4c = "SELECT CardNo, LastName from custdata LIMIT 5;"; $customers = $dbConn2->query("{$selectIs4c}"); if ($dbConn2->errno) { $message = sprintf("Select failed: %s\n", $dbConn->error); dieHere($message, $dieMail); } if (!$customers) { $msg = sprintf("Failed on: %s", $selectIs4c); dieHere("{$msg}", 0); } echo "IS4C Numbered\n"; while ($row = $dbConn2->fetch_row($customers)) { $flds = getNameKeys($row); $lineOut = implode("\t", $flds) . "\n"; echo $lineOut; $vals = getNameValues($row); $lineOut = implode("\t", $vals) . "\n"; echo $lineOut; $lineOut = implode("\t", array($row[CardNo], $row[LastName])) . "\n"; echo $lineOut; } dieHere("IS4C OK, bailing ...", 0); // is4cTestAndDie(); }
dieHere("Could not open {$outFile}\n"); } } $logger = fopen("{$logFile}", "a"); if (!$logger) { dieHere("Could not open {$logFile}\n"); } //echo "After ->query \n"; // Would it help to have both name and number keys? Don't think so. // was fetch_assoc while ($row = $dbConn->fetch_row($members)) { $inCount++; if ($inCount == 1) { // Write the names of the fields as column heads to the export file. //$flds = array_keys($row); $flds = getNameKeys($row); //echo "Fields: ", implode(" ", $flds), "\n"; $lineOut = implode("\t", $flds) . "\n"; $writeOK = fwrite($outer, $lineOut); //if ( $inCount > 0 ) { break; } } if (TRUE && $row['contact_id'] == $lastCid) { $dupCid++; $isDupCid = 1; // continue; } else { $uniqueCid++; $isDupCid = 0; $lastCid = "{$row['contact_id']}"; } /* For the first record for each member (same contact_id):