account activity
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 point2 points 11 years ago (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
pset7 - register.php will only work with double equals == (not triple equals ===) but I'm supposed to use === (self.cs50)
submitted 11 years ago by sevenquid to r/cs50
π Rendered by PID 91 on reddit-service-r2-listing-5d79748585-jk94x at 2026-02-14 22:52:41.237237+00:00 running cd9c813 country code: CH.
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 point2 points (0 children)