0

i am trying this from 5hrs don't know i am going wrong.My table echos results but not echo total for the same.

    <table width="102%" border="0">
    <tr>


      <th><b>Amount</b></th>
      <th ><strong>County</strong></th>

      </tr><?php

      (this fetches data ...$row = mysqli_fetch_array($res) or die(mysqli_error($db)))
echo "<tr>";
    echo "<td>" . $price . "</td>";
echo "<td>" . $rui['county'] . "</td>";
echo "</tr>";
(I get these entreis correct )
}
  }
(Below table is not echoed)
echo "<tr>";
echo "<td> .<b>Total </b>. </td>";  
echo "<td>" .$x. "</td>";
echo "<td></td>";
echo "</tr>";
?></table>
Tanveer Badar
  • 5,438
  • 2
  • 27
  • 32
aka66
  • 3
  • 3
  • Removed extra tags. – Tanveer Badar Nov 24 '19 at 13:55
  • It is a very bad idea to use `die(mysqli_error($conn));` in your code, because it could potentially leak sensitive information. See this post for more explanation: [mysqli or die, does it have to die?](https://stackoverflow.com/a/15320411/1839439) – Dharman Nov 25 '19 at 09:44

2 Answers2

0

Remove the } } after the closing tag of the tr. if you can't close the whole PHP block then you probably did something wrong in your syntax.

I don't know if you have more code or not, if you do - post it so we will get more accurate view of your code.

    <table width="102%" border="0">
<tr>


  <th><b>Amount</b></th>
  <th ><strong>County</strong></th>

  </tr>
<?php

(this fetches data ...$row = mysqli_fetch_array($res) or die(mysqli_error($db)))
echo "<tr>";
echo "<td>" . $price . "</td>";
echo "<td>" . $rui['county'] . "</td>";
echo "</tr>";
(I get these entreis correct )


(Below table is not echoed)
echo "<tr>";
echo "<td> .<b>Total </b>. </td>";  
echo "<td>" .$x. "</td>";
echo "<td></td>";
echo "</tr>";
}
?>
</table>
Yakir Malka
  • 308
  • 2
  • 11
0

You can remove the wrong bracket, OR check that the two bracket are opened when fetching data

<table width="102%" border="0">
    <tr>
        <th><b>Amount</b></th>
        <th ><strong>County</strong></th>
    </tr><?php
    //(this fetches data ...$row = mysqli_fetch_array($res) or die(mysqli_error($db)))
    echo "<tr>";
        echo "<td>" . $price . "</td>";
        echo "<td>" . $rui['county'] . "</td>";
    echo "</tr>";
    //(I get these entreis correct )
    //(Below table is not echoed)
    echo "<tr>";
        echo "<td> .<b>Total </b>. </td>";  
        echo "<td>" .$x. "</td>";
        echo "<td></td>";
    echo "</tr>";
    ?>
</table>
Mahefa
  • 418
  • 3
  • 12