I'm completely a newbie and I have this problem drilling into my head. Any fast help will be highly appriciated.
I have a table "peoplebase" and there's a column "alias_switch". Now I want a script to act as a switch, if "alias_switch" is "1" then it should make it "2", if "2" it should make it "3" and if it is "3", it should revert it back to "1". I'm doing it in PHP. Please help me. I'm using the following code but it is not working properly. It counts till '2' and sticks.
$result = mysql_query("SELECT alias_switch FROM peoplebase");
$n = mysql_fetch_assoc($result);
if ($n = "1"){
mysql_query("UPDATE peoplebase SET alias_switch='2'");
}
else if ($n = "2") {
mysql_query("UPDATE peoplebase SET alias_switch='3'");
}
else if ($n = "3") {
mysql_query("UPDATE peoplebase SET alias_switch='1'");
}
Please help me with it fast. Thank you all in advance.