I want to be able to switch between two sql statements.. I'm sending the values through a form calling the function below :) [code] ////////////////////////////////////////////////// function checkUser($name,$mail) { $conn_id = ifx_connect ("db@atkin") or die("Cant open database"); $query = "SELECT name FROM bUser where name == '$name'"; $result = ifx_query ($query, $conn_id) or die("Cant SELECT"); if ($result !== null) { print "UPDATE"; $query = "UPDATE bUser SET email = '$mail' where name == '$name'"; $result = ifx_query ($query, $conn_id) or die("Cant UPDATE"); } else { print "INSERT"; $query = "INSERT INTO bUser Values ('$name','$mail')"; $result = ifx_query ($query, $conn_id) or die("Cant INSERT"); } ifx_free_result($result); ifx_close($conn_id); } ?> [/code] -------------------------------------- Well, the idea is to update the email of a person if that person exists in the database. If not then add him/her to the database. But the If statement doesn't work, the only thing that works is the update query. When I try to print $result to see whether it's null or not I see that it contains a string "Resource id2".. so that's why the update query works and not the insert. Shouldn't $result be null if name doesn't exist? Thx in advande :)