1

I need to check one value in database which is duplicated or not. I don't know in Joomla object based method is available for this check. I used object based Joomla api method for insert and update database using the below code

$this->_db->insertObject($table,object);

But I need to know the Joomla object based method available for duplication check.

Kindly assist. I am new to the Joomla platform.

2

There is no way to do this without first doing a look up to check if the value already exists in the db before inserting.

The "check" that Joomla does is for the primary key only - so it cannot insert if the primary key is duplicated.

The correct way is to create a table class that extends JTable and then implement the bind/check/save methods of that with your additional data integrity logic, or one step up in the model apply your business logic there see The JTable Class - see also How to use the JTable Class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.