Ok, so heres the sql query, arrays and loop
$entryID[$entry] = array();
$entryName[$entry] = array();
$entryDate[$entry] = array();
$entryRW[$entry] = array();
$entryValue[$entry] = array();
$entrySelect[$entry] = array();
$entryBalanceSheet[$entry] = array();
$NoOfEntries = array();
$SQL = "SELECT * FROM Entry WHERE UserID = '$userID' AND (EntrySelect=4 AND (EntryBalanceSheet=1) OR (EntryBalanceSheet=2))";
$result = mysql_query($SQL) or die(mysql_error());
$num_rows = mysql_num_rows($result);
if ($num_rows <1 || $num_rows =="")
{
$NoOfEntries= false;
}
else
{
$entry = 0;
$NoOfEntries = $entry;
while ($row = mysql_fetch_array($result))
{
$entryID[$entry] = $row['EntryID'];
$entryName[$entry] = $row['EntryName'];
$entryDate[$entry] = $row['EntryDate'];
$entryRW[$entry] = $row['EntryRW'];
$entryValue[$entry] = $row['EntryValue'];
$entrySelect[$entry] = $row['EntrySelect'];
$entryBalanceSheet[$entry] = $row['EntryBalanceSheet'];
$entry ++;
$NoOfEntries = $entry;
}
}
And then I'm trying to echo some of the data into a table, like so
<?php if ($NoOfEntries= true)
{
?>
<tbody>
<tr>
<td><?php echo $entryID; ?></a></td>
<td><?php echo $entryDate[$entry]; ?></a></td> <!-- Add imputs from database -->
<td><?php echo $entryName[$entry]; ?></td>
<td><?php if ($entryBalanceSheet=="1") echo "Intangible"; else if ($entryBalanceSheet=="2") echo "Tangible"; ?></td>
<td>£<?php echo $entryValue[$entry]; ?></td>
<td>##</td>
<td><?php printf('<a href="FixedAssetAddRate.php?id=%d&action=Add"><img title="Add Depreciation Rate" src="css/button/plus.png"/></a>', $entryID)?>
<td>##</td>
<td>£<?php echo $entryValue[$entry]; ?></td> <!-- change when Depreciation rate is sorted -->
<td><?php printf('<a href="FixedAssetView.php?id=%d&action=view"><img title="View This Fixed Asset" src="css/button/view.png"/></a>', $entryID)?>
<td><?php printf('<a href="AccountEntry.php?ID=%d"><img title="Edit This Fixed Asset" src="css/button/edit.png"/></a>', $entryID)?></td>
</tr>
</tbody>
<?php }
else { echo "No entries";}?>
Anyway, the table appears blank, and I cant figure it out for the life of me. theres a image attached of what the table looks like.
I know its not a problem with the database of connecting to the database, its defo in the script, i just cant find the problem.
Any help is grately apprieciated
Thanks