I have categories in my blog and i want the result if you edit the category name, then category names of the posts will change as well
if(isset($_POST['update_cat'])){
$cat_id = $_POST['cat_id'];
$cat_name = $_POST['cat_name'];
$var=mysqli_query($con,"UPDATE category SET category_name = '$cat_name' WHERE category_id = $cat_id");
if ($var) {
$var2=mysqli_query($con,"UPDATE post INNER JOIN category on post.postCategory=category.category_name SET postCategory = '$cat_name' WHERE postCategory = $cat_name");
}