For the life of me can't figure out what is wrong with the following code. Running the following with either $query separate works fine. I am using similar code on other forms running three queries that work just fine. Only different here is that one of the queries contains a join. But just don't see anything wrong.
When I run the above I get an error:
Even though I get the error the first statement executed, which also contains the a.id, works and I see the updated results in the table. The second statement does not contain a.id as I switched them all to 'c' as a test and has no results in the table.
-Eugene
PHP:
$linkInterview = '<a href="/linked/interviews/form/46/'.'{fab_interviews___id}' . '"' . '>Interview</a>';
$link = '<a href="/linked/interviews/form/46/'.'{fab_interviews___id}' . '"' . '>Open</a>';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->update($db->quoteName('fab_applications', 'a'))
->join('INNER', $db->quoteName('fab_interviews', 'b') . 'ON ' . $db->quoteName('a.id') . ' = ' . $db->quoteName('b.applicant'))
->set($db->quoteName('a.link_interview') .' = ' . $db->quote($linkInterview))
->where($db->quoteName('a.id') . ' = ' . '{fab_interviews___applicant}');
$db->setQuery($query);
$db->execute();
$query
->update($db->quoteName('fab_interviews', 'c'))
->set($db->quoteName('c.link') . ' = ' . $db->quote($link))
->where($db->quoteName('c.id') . ' = ' . '{fab_interviews___id}');
$db->setQuery($query);
$db->execute();
When I run the above I get an error:
Error
Unknown column 'a.id' in 'where clause'
Even though I get the error the first statement executed, which also contains the a.id, works and I see the updated results in the table. The second statement does not contain a.id as I switched them all to 'c' as a test and has no results in the table.
-Eugene