Hi
I want to use php to insert a count of records from a list with a 'where' statement using a value from this list. I have done this in calc but I want to use php to store the values.
I can do this fine when the count is using data from another table however I keep running into problems when wanting to count from the list itself.
I have used a subquery but can not work out how to filter the list ('where'). I have got it this far but all my attempts at using a 'where' statment have failed.
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->update('pattern_table')
->set('co_count = (select mycount from (SELECT count(*) as mycount from pattern_table) as d)');
$myDb->setQuery($myQuery);
$myDb->execute();
If someone could kindly assist I would be very grateful.
Kind Regards
I want to use php to insert a count of records from a list with a 'where' statement using a value from this list. I have done this in calc but I want to use php to store the values.
I can do this fine when the count is using data from another table however I keep running into problems when wanting to count from the list itself.
I have used a subquery but can not work out how to filter the list ('where'). I have got it this far but all my attempts at using a 'where' statment have failed.
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->update('pattern_table')
->set('co_count = (select mycount from (SELECT count(*) as mycount from pattern_table) as d)');
$myDb->setQuery($myQuery);
$myDb->execute();
If someone could kindly assist I would be very grateful.
Kind Regards