I don’t think you need 3 queries. One should be fine selecting both values. Queries 2 & 3 are identical anyway.
$result1 = mysqli_query($con,"SELECT company_id, closed_state FROM tbl_company WHERE company_id='$company_id'") or die(mysql_error());
while($row = mysqli_fetch_array($result1)){
if ($row['closed_state'] == "yes"){
echo '<a href="https://stackoverflow.com/questions/30514499/customers_open.php?company_id=".$row['company_id'].'">Reopen account</a>';
}else{
echo '<a href="customers_close.php?company_id='.$row['company_id'].'">Close account</a>';
}
}
1
solved Best way to echo variable in PHP [closed]