H
H
Horosh2942020-06-21 10:31:25
SQL
Horosh294, 2020-06-21 10:31:25

How to change data in database via sql?

The site database on dle has a news id column. You need to change the category column using sql, there are already values ​​there 124,123, one more value ,125., with a given value id = 1357912.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2020-06-21
@Horosh294

UPDATE dle_post SET category = CONCAT( category, ',125' ) WHERE id = 1357912

A
Alexey Tutubalin, 2020-06-21
@Kennius

$sql = $db->query("SELECT 'category' FROM 'dle_post' WHERE 'id' = '10624' ");
while( $row = $db->get_row($sql) ) {	
  $add_cats = ",125";
  $sql1 = $db->super_query("UPDATE 'dle_post' SET 'category' = "{$row['category']} . {$add_cats} " WHERE 'id'`' = '10624' ");
}

I see something like this, first you need to get a list of current categories and add to it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question