While user logs in I am saving login time, remote address, etc. in my security logs table, and so I need to be sure all insert’s and updates are performed and hence I am using this:
if(mysqli_query($db_connect, "query")) {
//True So Continue Execution
} else {
//Redirect To Login
}
So to make the code shorter I want to use ! before executing query:
if(!mysqli_query($db_connect, "query")) {
//Redirect To Login
}
So any pros or cons for doing this?
It doesnt really matter. Just try to avoid empty blocks for pretty-look code.