Is it possible to use an IF statement in PHP along with differnet sql queries? : Basically I want to update a value in the table if the date field is equal to todays date, otherwise I'd like to insert a new row into the table if the date is not equal to today. Say for example something like (I know syntax is wrong here) - 

    if($date == $today){
       $sql = $con->query("UPDATE table SET field= 'field+$value', field2='field2 + $value2' WHERE id=2")
    }else{
         $sql = $con->query("INSERT INTO table (field1, field,2,field3)VALUES('{$value1}', '{$value2}', '{$value3}')");
}

How would I go about doing something like this? is using an if statement like this in php/SQL queries possible? or is there a different way that it has to be done?
Cheers.