I have the follow code.
$acct="SELECT acctype FROM users WHERE username='$username'";
Then I have this If statement
if ($acct="customer") {
Header("Location: user/dashboard.php");
}
else {
Header("Location: other/dashboard.php");
}
Sample database output
mysql> select * from users;
+----+----------+----------------------------------+----------+----------+----------+
| id | username | password | fullname | location | acctype |
+----+----------+----------------------------------+----------+----------+----------+
| 14 | customer | 91ec1f9324753048c0096d036a694f86 | customer | customer | customer |
| 15 | mfg | fcc66ac1c0e07a00b56b0dc4c0902567 | mfg | mfg | mfg |
| 16 | designer | 230ace927da4bb74817fa22adc663e0a | designer | designer | designer |
| 19 | both | f6cb3e816496528d4187db53bc66567f | both | both | both |
+----+----------+----------------------------------+----------+----------+----------+
So my goal is to have user when they login if their acctype is customer go to user/dashboard.php
If the acctype is anthing else go to other/dashboard.php
For some reason it is ignoring the acctype and just going to the first if condition.
Running the Query through MySQL will output the correct response.
mysql> SELECT acctype FROM users WHERE username='customer';
+----------+
| acctype |
+----------+
| customer |
+----------+
1 row in set (0.00 sec)
mysql> SELECT acctype FROM users WHERE username='both';
+--------+
| acctype|
+--------+
| both |
+--------+
1 row in set (0.00 sec)
Where am i going wrong?