This question already has an answer here:
How to check empty row in a table using php?
I tried with this code, but it doesnt work:
<?php
ob_start();
session_start();
require 'connection/config.php';
$id = $_GET['id'];
echo $id;
$userid = $_SESSION['userid'];
$sql = "select * from post where id='$id'";
//echo $sql;
$result1 = mysqli_query($conn, $sql);
while ($row1 = mysqli_fetch_array($result1)) {
echo $row1['message'] . "<br>";
$_SESSION['pid'] = $row1['id'];
$userid = $_SESSION['userid'];
echo $userid;
$a = $row1['id'];
$sql = "select * from post inner join likenew on post.id=likenew.postid where likenew.postid='$id' and likenew.userid='$userid'";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result)) {
if (empty($row)) { ? >
< a href = "ative.php?id=<?php echo $row['id'];?>" > ready < /a><?php
} else { ? >
< a href = "deactive.php?id=<?php echo $row['id'];?>" > notready < /a><?php
}
}
}
</div>