Hello,
I'm trying to update a row in my articles database, with a custom code.
This gives as line of code:
Which is a legit MySQL string, it works in PHYMyadmin, but not via this way. Does someone know if Chronoforms needs another parameter to update or something?
I'm trying to update a row in my articles database, with a custom code.
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM `#__content`
WHERE `id`='203'";
$db->setQuery($query);
$data = $db->loadAssocList();
$countArticles = count($data);
if($countArticles > 1){
$articlesIDarray;
for($i=0; $i < $countArticles; $i++){
$articlesIDarray.push($data[$i]['id']);
}
$latestIDnumber = max($articlesIDarray);
} else {
$latestIDnumber= $latestArticle['id'];
}
//Catid update
$query2 = "
UPDATE `jos_content` SET `catid` = '".$form->data['category']."' WHERE `id`='203'";
$db->setQuery($query2);
echo $query2;
This gives as line of code:
UPDATE `jos_content` SET `catid` = '14' WHERE `id`='203'
Which is a legit MySQL string, it works in PHYMyadmin, but not via this way. Does someone know if Chronoforms needs another parameter to update or something?
Hi huubs,
Please try adding
Bob
Please try adding
$db->execute($query2);
to actually execute the query?
Bob
This topic is locked and no more replies can be posted.