0

I want to check the status of delivered data whether it is seen or not seen before clicking the view link if it is status is unseen the view link has to be blink otherwise stop blinking and I have tried the below code but it doesn't work by saying:

Notice: Undefined property: stdClass::$all in C:\xampp\htdocs\dataman\view_data.php on line 105 for each displayed view link.

<?php 
$dataID ='all';
foreach( $diReturn as $key => $diReturn): 
echo "<tr >";
$sql="SELECT * FROM report WHERE view='notseen'";
$query=mysql_query($sql);
if($query)  {       
echo "<td width='150'> <a href='disdata.php?id=". $diReturn->$dataID ."' 
class='blinking'><span> View </span> </a> </td> ";
}else{
echo "<td width='150'> <a href='disdata.php?id=". $disReturn->$dataID ."'> 
View </a> </td> ";
}
echo "</tr>";
endforeach;
?>
SAVe
  • 814
  • 6
  • 22
Jorge
  • 47
  • 5
  • Please add whole code of "view_data.php" here, so that we can find out issue. – Dhananjay Kyada Jun 17 '19 at 09:56
  • Possible duplicate of [Why shouldn't I use mysql\_\* functions in PHP?](https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Dharman Jun 17 '19 at 10:00
  • First, you should switch from `mysql_query()` to `mysqli_query` or PDO. Second, `$query=mysql_query($sql);` will return a FALSE value on a SELECT only if an error occurred and not if no rows have been returned. To check the number of rows, execute `mysqli_num_rows($query);` (after switching to the `mysqli_*` functions). Also why do you execute the same query multiple times? You might also have a typo as your variable is called `$diReturn` and three lines later `$disReturn`. – SaschaM78 Jun 17 '19 at 12:43

0 Answers0