> MySQL v.4.1.14


Hi.

Ive resolved my problems, however I had to go in a round-about way.

1) Timestamp on server does not auto-update when record updates..

ON UPDATE CURRENT_TIMESTAMP

2) ON DUPLICATE KEY UPDATE apparently does not work on the server.

(I tried various known & unknown ways of doing the above)....

Here is the working code:

Code:
if ($result = $mysqli->query("SELECT Reference FROM Master where Reference='$_reference'")) {

    /* determine number of rows result set */
    $row_cnt = $result->num_rows;
    printf("Result set has %d rows.\n", $row_cnt);
    /* close result set */
    $result->close();
}

if($row_cnt>0)
{
$sql="UPDATE Master SET Checked=NOW(), Title=\"$_title\", description=\"$_description\"
WHERE
Reference='$_reference'";
}
else
{
$sql="INSERT INTO `Master` ('Checked', 'Reference', 'Title', 'description')
VALUES(NOW(), \"$_reference\", \"$_title\", \"$_description\")";
}

$mysqli->query($sql);
$affrows = $mysqli->affected_rows;

if ($mysqli->query($sql) === TRUE) {
    echo "New record created successfully";

} else {
    echo "Error: " . $sql . "<br>" . $mysqli->error;
}

$mysqli->close();