Objective is to change value of regStatus of table registration to 'd' from 'a'
I was trying to update MySql table using following code nothing happens
<?php
if($r_regStatus == 'a'){
echo "<a href='option2.php?r_id=$r_id&r_regStatus=$r_regStatus'> Deactivate</a>";
} else {
echo "<a href='option2.php?r_id=$r_id&r_regStatus=$r_regStatus'> Activate</a>";
}
?>
option2.PHP
------------
<?php
include 'connect.php';
include 'functions.php';
$r_id = $_GET['r_id'];
$regStatus = $_GET['r_regStatus'];
if($regStatus == 'a'){
mysql_query("UPDATE `registration` SET `regStatus`='d' WHERE `id`='$r_id'");
echo mysql_query("UPDATE `registration` SET `regStatus`='d' WHERE `id`='$r_id'");
header('location:registration.php');
} else if($regStatus == 'b') {
mysql_query("UPDATE `registration` SET `regStatus`='a' WHERE `id`='$r_id'");
header('location:registration.php');
}
?>
You should use
if($regStatus === 'a')
and
else if($regStatus === 'b')
Also, check with echo that you have the values you think you have in $regstatus
and $r_id