I've got a joomla database with 'jos_content' table that contains the particulars concerning the articles.

For the reason that table, the column 'attribs' is of TEXT datatype, which consists of data concerning the article qualities, like:


I'm attempting to customize the property 'show_print_icon' to ensure that it'll have 1, such as this:


With this, i've written a question that replaces the 'show_print_icon=0' to 'show_print_icon=1' within the column.

UPDATE jos_content set attribs=replace("attribs", "%print_icon=0\nshow_email%",
"%print_icon=1\nshow_email%") where attribs like '%print_icon=0\nshow_email%';

For whatever reason, after performing this question, i acquired the column values as empty. I possibly could not understand where did time passes wrong. What is the issue with query?

One of the ways is :

$sql = "Select attribs from jos_content";
$db = JFactory::getDBO():
$contents = $db->loadObjectList();

foreach($contents as $content){
   $attribs = $content->attribs;
   $attribs = explode("\n", $attribs);
      $attribs['show_print_icon'] = 1;
      $content->attribs = implode("\n", $attribs);
   // run the update query here for each content

I'll inform you other, using Com Content Model

Look into the newline character. It might not be n, it may be also rn or simply r, which means you can't dependably match about this rule.

Also, why do you want the written text surroundig? It simply makes your login more complicated of computer needs to be. You'll have to be certain to help keep consistent data and do not have the variables there in another order for instance.

I'm not sure what's your database structure there, but attempt to match on exactly what you ought to change. When not possible now, than try to modify your logic which means you have the ability