I am trying to get a conditional insert so I do not duplicate entries in the table but you are not inserting anything to me
Code
<?php
session_start();
if(isset($_SESSION['user_id'])){
mysql_query("INSERT INTO visitas_estabelecimento (user_id, estabelecimento_id) VALUES ('".$_SESSION['user_id']."', '".$row_cat->id."')
WHERE NOT EXISTS
(SELECT * FROM visitas_estabelecimento
WHERE estabelecimento_id='".$row_cat->id."' and user_id='".$_SESSION['user_id']."'");
}
?>
$row_user_id=mysql_fetch_object($result_verifica);
$_SESSION['user_id'] = $row_user_id->id;