Sorry. I was angry with ADODB. Here is the problem block of code, edited to protect the innocent.
[PHP]require_once("adodb/adodb.inc.php");
** This section (removed) opens and reads a CSV file and places the data in $data
$conn = &ADONewConnection("mssql://user:pass@nn.nn.nn.nn/name") or die ("Could not connect to database");
foreach ($data as $k=>&$line) {
// Loop over all records, checking for validity.
$partcode = trim($line['part']);
$effdate = trim($line['eff_date']);
$cost = trim($line['cost']);
(strlen($partcode) != 0) or die("<br>Part code missing at line <b>$k</b>");
(strlen($effdate) != 0) or die("<br>Effective date missing at line <b>$k</b>");
//Now check the part exists before attemptng an UPDATE
$checkQuery = 'SELECT 1 FROM part WHERE part LIKE '.$conn->Quote($partcode);
$recordset = $conn->Execute($checkQuery);
if($recordset->RecordCount())
{
//Now check the part and effective date are not being duplicated
$checkQuery = 'SELECT 1 FROM part_cost,part_ccel
WHERE part LIKE '.$conn->Quote($partcode) 'AND eff_date LIKE '.$conn->Quote($effdate);
$recordset = $conn->Execute($checkQuery);
if(!$recordset->RecordCount())
{
**Fails here**[/PHP]
The first query executes OK and the first call to RecordCount() works fine.
The second query executes fine but the call to RecordCount() produces this error.
- 'Fatal error: Call to a member function RecordCount() on a non object'.
I've looked at the ADODB manual, which says -1 may be returned from RecordCount "if the number of rows returned cannot be determined"
This could be the problem, although the error indicates something else.
Thanks in advance for help.