I have a table display records from database. One of my column is for delete, what I need is if the value is in both table1 and table2, void the link. Or if value is in only on table1 delete button should not be void. Help please?
$query1 = $mysqli1->query("select * from code WHERE item LIKE '%$search%' OR item_code LIKE '%$search%' OR cat_code LIKE '%$search%' order by item_code ASC");
$query2 = $mysqli1->query("SELECT count(*) FROM code");
$query3 = $mysqli->query("SELECT count(*) FROM app");
while($r = $query1->fetch_assoc()){
echo"<tr>
<td>".$r['item']."</td>
<td>".$r['cat_code']."</td>
<td>".$r['item_code']."</td>";
if(mysqli_num_rows($query3) == 0 && mysqli_num_rows($query2) == 0) {
echo "<td><a href='#' id='".$r['id']."' class='del'><img src='../images/del.png'></a></td>";
} else {
echo "<td><a href='javascript:void(0)'><img src='../images/stop.png'></a></td>";
echo"</tr>";
}
If ACR-100 is in on both table in database, link should be void
Table1 -------------- Table2
Code | Code
------ | ------
ACR-100 | ACR-100
Else, if ACR-100 is only on table1, link should not be void.
Table1 -------------- Table2
Code | Code
------ | ------
ACR-100 |