Merhaba,
Açıkcası biraz ezbere işler yapmaya çalışıyorum gerek videolar izleyerek vs. buttonları aktif ettim yalnız 'Active' butonuna bastıgımda 'Deactive' olmuyor sebebi ne olabilir yardımcı olabilirmisiniz.
<div class="page-content fade-in-up">
<div class="ibox">
<div class="ibox-head">
<div class="ibox-title">Category</div>
</div>
<div class="ibox-body">
<table class="table table-striped table-bordered table-hover" id="example-table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Category ID</th>
<th>Category Name</th>
<th>Status</th>
<th colspan="3" class="text-center">Operations</th>
</tr>
<tr>
<?php
while ($row = mysqli_fetch_assoc($value))
{
?>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['cat_name']; ?></td>
<td>
<?php
if($row['status']=='1')
{
echo "Active";
}
else
{
echo"Deactive";
}
?>
</td>
<td class="text-center">
<?php
if ($row['status']=='1')
{
echo "<a href='manage_category.php?opr=deactive&id=".$row['id']."' class='btn btn-success'>Deactive</a>";
}
else
{
echo "<a href='manage_category.php?opr=active&id=".$row['id']."' class='btn btn-success'>Active</a>";
}
?>
<a href="edit_cat.php?id=<?php echo $row['id'] ?>" class="btn btn-primary">Edit</a>
<a href="#" class="btn btn-danger">Delete</a>
</td>
</tr>
<?php
}
?>
</thead>
</tbody>
</table>
</div>
</div>
</div>FONKSİYON; function active_status()
{
global $con;
if(isset($_GET['opr']) && $_GET['opr']!="")
{
$operation = safe_value($con,$_GET['opr']);
$id = safe_value($con,$_GET['id']);
if($operation== 'Active')
{
$status = 1;
}
else
{
$status = 0;
}
$query = "update categories set status='$status' where id='$id'";
$result = mysqli_query($con,$query);
if($result)
{
header("location:manage_category.php");
}
}
}manage_category.php php içeriğine 'active_status();' şeklinde ekledim ama , bir türlü çalıştıramadım 2 gündür çıldırmama ramak kaldı