Hello everyone i have a little problem over here im making share button so i want to update the database on the column 'isShared' with value 1
so here is my code but it doesnt work, all the time is showing me Already shared ticket!
Here is the code:
if(isset($_POST['share'])) {
$user = getUserData('kladilnica', 'Username');
$shared1 = getUserData('kladilnica', 'isShared');
$sql = "SELECT `isShared` FROM kladilnica WHERE Username='".$user."'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$shared = $row["isShared"];
if($shared == 1){
echo "<b>Already shared ticket!</b>";
} else if($shared == 0){
echo "<b>Ticket shared succesfully.</b>";
}
}
}
Btw if someone knows a better way of making share button please tell in the comments i got this solution on my own.. thank you very much :)