Question

$trans='INSERT INTO xbq3a_lovefactory_memberships_sold values ('.$member[0].','.$member[1].','.$p[3].','.$member[3].',
"'.$member[4].'","'.$member[5].'",'.$member[6].','.$member[7].',
'.$member[8].',"'.$member[9].'",'.$member[10].','.$member[11].',
'.$member[12].','.$member[13].','.$member[14].','.$member[15].',
'.$member[16].','.$member[17].','.$member[18].','.$member[19].',
'.$member[20].','.$member[21].','.$member[22].')';

$this->_db->setQuery($trans);

member is one array retrieving data related to membership from database

Was it helpful?

Solution

I'm not sure which version of Joomla you're using but assuming that $this->_db points to a Joomla Database object, i.e. and instance of JDatabase then your code has a few problems and is incomplete.

Long answer go and read the Developer docs on the Joomla Docs site, specifically you will want to start with the "Accessing the database using JDatabase" article.

Shorter answer:

  1. The reference to xbq3a_lovefactory_memberships_sold should be written as #__lovefactory_memberships_sold otherwise

    1. it will only ever work on one website that uses that prefix
    2. if the super admin changes the prefix later on your code will break.
    3. using the Joomla convention of #__ for the prefix will make your code portable as Joomla automatically replaces the #__ with the correct prefix for the current installation.
  2. In the code you've posted you assign the query in $this->_db->setQuery($trans); to the db object but you don't actually execute it. To execute your query try adding $this->_db->query();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top