Hey guys!
This is the first time that I have come across the following query:
$sql = “SELECT * FROM users WHERE admin < “.$admin[‘admin’].”+1”;
What is the meaning of the + 1 and < then sign? thanks!
Hey guys!
This is the first time that I have come across the following query:
$sql = “SELECT * FROM users WHERE admin < “.$admin[‘admin’].”+1”;
What is the meaning of the + 1 and < then sign? thanks!
Hi!
SQL queries accept mathematical expressions.
<
means less than
+
increments the value from left by the value from right.
Thanks for the reply but I am still confused. as to what to expect from that query?
It basically selects all rows from users
where users.admin
is less than $admin['admin']+1
. I assume $admin['admin']
is a number.
Yup! $admin[‘admin’] is either a 1 or 0, 1 being an admin and 0 being not an admin… I am still not sure what it is selecting here… still sounds a bit confusing… why can’t I just select $admin[‘admin’] == 1?
You asked for what that query does. What it is used for inside app I don’t know …
I will post the video here and I hope that someone can tell me what it does… I just hope that my codes are correct: