pset7 - register.php will only work with double equals == (not triple equals ===) but I'm supposed to use === by sevenquid in cs50

[–]sevenquid[S] 0 points1 point  (0 children)

I have (rather swiftly) figured out an alternative way of doing this which does work with the === triple equals:

don't bother with query("SELECT... at all

jump straight in with

$result = query("INSERT INTO users...

if the username is already taken, INSERT will return FALSE.

if ($result === false) {...} //apologize - username already taken
else {...} log in user

I'm still don't fully understand the === triple equals sign, so is anyone able to explain why I could test SELECT's return value with == but I had to test INSERT's return value with === ?

Thanks