hey guys, so im trying to display data from my database into a table but i got this error :
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\CashFlow\balance_report.php on line 45
code:
<?php
require "connect.php";
if($_SESSION['name'])
{
$name = $_SESSION['name'];
$query=("SELECT * FROM asset WHERE name = $name");
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
echo "<b><center>Asset</center></b></br>";
$i=0;;while($i<$num)
{
$house=mysql_result($result,$i,"house");
$vehicle=mysql_result($result,$i,"vehicle");
$current=mysql_result($result,$i,"current");
$savings=mysql_result($result,$i,"savings");
$kwsp=mysql_result($result,$i,"kwsp");
$haji=mysql_result($result,$i,"haji");
$asb=mysql_result($result,$i,"asb");
$stock=mysql_result($result,$i,"stock");
$property=mysql_result($result,$i,"property");
$others=mysql_result($result,$i,"others");
$total=mysql_result($result,$i,"total");
echo "<table border='1'>
<tr>
<td><b>Personal</b></td>
</tr>
<tr>
<td>House : $house</td>
</tr>
<tr>
<td>Vehicle <dfn>(Car,Motorcycle etc)</dfn> : $vehicle</td>
</tr>
<tr>
<td><b>Cash</b></td>
</tr>
<tr>
<td>Current Account : $current</td>
</tr>
<tr>
<td>Savings Account : $savings</td>
</tr>
<tr>
<td><b>Investments</b></td>
</tr>
<tr>
<td>KWSP : $kwsp</td>
</tr>
<tr>
<td>Tabung Haji : $haji</td>
</tr>
<tr>
<td>ASB : $asb</td>
</tr>
<tr>
<td><b>Stock : $stock</b></td>
</tr>
<tr>
<td><b>Property : $property</b></td>
</tr>
<tr>
<td><b>Others</b> : $others</td>
</tr>
<tr>
<td><b>Total</b> : $total</td>
</tr>
</table>",$i++;
}
}
?>
what am i doing wrong?