REPLACE INTO Not Working
<p>I'm having an odd issue that is my replace into query is not working , I have tried numerous times to see if Ive missed anything but still cannot seem to understand what could be causing my query not to work .</p>

<p>The query is $sqlt4 the last query below I'm having this issue with .</p>

<p>visited is my table name , online is the col I'm indexing "No" is just a string im trying to replace into .</p>

<p>I have a unique index on username and id is AI</p>

<p><a href="https://i.stack.imgur.com/rrJPD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rrJPD.png" alt="enter image description here"></a></p>

<p>Can somebody please help with this , Thanks.</p>

<pre><code>include('..\db.php');
$con = mysqli_connect($dbsrvname, $dbusername, $dbpassword, $dbname);


//if user session is active 
if(isset($_SESSION['CurrentUser'])){

    //This works fine
    $sqlt2 = mysqli_query($con,"REPLACE INTO active_members VALUES ('".$_SESSION['CurrentUser']."','".$time."')");

    // LAST SEEN ONLINE TIME FOR THE USER , This works fine
    $sqlt3 = mysqli_query($con,"REPLACE INTO visited (username, time, online) VALUES ('".$_SESSION['CurrentUser']."',now(), 'No')");

}  // end if

else{
    //if no session active  users logs out

    //NEED TO FIND OUT WHY IT WONT WORK TO REPLACE
    $sqlt4 = mysqli_query($con,"REPLACE INTO visited (online) VALUES ('Yes')");


}  // end else
</code></pre>