Hi,
I am developing a CB plugin where I need database connection. The plugin itself get connection of CB database classes and methods. However, I have used an ajax file where I need database connection. My problem is that in the ajax file I can't use CB database methods like $_CB_database->setQuery().
//My script. file name i.e : ajax_query.php
Code:
global $_CB_framework, $_CB_database,$mainframe;
$query = "SELECT id,field_a,field_b FROM #__comprofiler_plug_mytable";
$_CB_database->setQuery( $query );
$result = $_CB_database->loadObjectList();
It's reponse:-
Fatal error</b>: Call to a member function setQuery() on a non-object
What I feel that I need to include CB db connection file in my ajax_query.php. Can you please help me how can I execute this query in my php file? Thanks in advance.