OJS 3.1 using sql in plugin

Hello. Please help me with using sql in generic plugin. How I can do it?

Hi @sarkhan,

What do you want to do with SQL?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,

For example getting title from submission_settings

I think that you are looking for this function

$title = $this->getData('title', $locale);

$this variable must replace it with the object that you want to instantiate (article, site, journal, etc.). If it is not already created, you must create it.

Another way (hard coding) can use the function retrive. In that function you can write the sql you want
Example:
$result = $this->retrieve(‘SELECT * FROM submissions WHERE submission_id = 100’);

Regards
Cristian

Hello. Can you also show me how I can get object after sql. Should I use $result-> title, or $result[‘title’] or something else?