/** * will update the Relational DB table; if trying to update the table containing the key, give both $tableName1 and $keyTable as the * same value. * @param: $tableName1: the table you wish to update * @param: $keyTable: the table containing the cross-table Key * @param: $foreignkey: the foreignKey you're using to check; * @param: $valueForKey: the value for the foreignKey; * @param: $primaryKey: the primaryKey of the database (the cross-table Key); * @param: $arrayOfValues: the values being updated; * Postcondition: updates the table if entry already exists; * Postcondition: creates a new entry if entry does not exist; */ public function updateTable($tableName1, $keyTable, $foreignKey, $valueForKey, $primaryKey, $arrayOfValues, $condition) { $result = $this->selectFromTable($keyTable, $foreignKey, $valueForKey); $num = mysql_num_rows($result); if ($num == 0) { $this->insertIntoTable($tableName1, $keyTable, $foreignKey, $valueForKey, $primaryKey, $arrayOfValues); return true; } else { parent::updateTable($tableName1, $arrayOfValues, $condition); return true; } }