<?php
require_once("models/config.php");
  if(isUserLoggedIn()) { 
   
  }else{
    header("Location: index.php"); die(); 
  }
 $id = $_POST["id"][0];


$mysqli = new mysqli("localhost", "bdicentralserver_sc", "Myl-PGfSbzcf", "bdicentralserver_sc");
$sp = $mysqli->query("SELECT * FROM category_xref_user_mx WHERE user_id = ".$loggedInUser->user_id." AND category_id = ".$id);
if ($sp->num_rows==0) {
$mysqli->query("INSERT INTO category_xref_user_mx (category_id, user_id) VALUES (".$id.",".$loggedInUser->user_id.")");
}
?>