Jump to content

Membership Page with transactions of accounts


carlito.way00

Recommended Posts

I have removed the pagination page so I could use while loop to create this membership page but the while loop  counter does not update if a transaction page is carried out. rather it updates the row of the last transaction with the current transaction.

 

Help needed will be appreciated for the code below:

<?php
$sql = "SELECT * FROM  members WHERE username='".$_SESSION['username']."'";
$result = mysql_query($sql);
echo "<table width = '90%' border = '1' align = 'center'>";
echo "<tr>";
echo "<th width = '5%' height = '20' align = 'center'>No</th>";
echo "<th width = '10%' height = '20' align = 'center'>Date</th>";
echo "<th width = '13%' height = '20' align = 'center'>Amount($)</th>";
echo "<th width = '15%' height = '20' align = 'center'>Balance($)</th>";
echo "<th width = '10%' height = '20' align = 'center'>Charges($)</th>";
echo "<th width = '15%' height = '20' align = 'center'>Transaction Type</th>";
echo "<th width = '10%' height = '20' align = 'center'>Status</th></tr>";
$counter = 1;	 
while  ($row = mysql_fetch_array($result))
{
   $statementdate = $row["statementdate"];
   $amounttransact = $row["amounttransact"];
   $acctbal = $row["acctbal"];
   $charges = $row["charges"];
   $transctype = $row["transctype"];
   $transtatus = $row["transtatus"];
   echo "<tr>";
   echo "<td align = 'center'>$counter</td>";
   echo "<td align = 'center'>".$fetch_users_data->statementdate."</td>";
   echo "<td align = 'center'>".$fetch_users_data->amounttransact."</td>";
   echo "<td align = 'center'>".$fetch_users_data->acctbal."</td>";
   echo "<td align = 'center'>".$fetch_users_data->charges."</td>";
   echo "<td align = 'center'>".$fetch_users_data->transctype."</td>";
   echo "<td align = 'center'>".$fetch_users_data->transtatus."</td></tr>";
   $counter++;	
}	
echo "</table>";
?>

 

 

Link to comment
Share on other sites

Why are you doing this:

".$fetch_users_data->statementdate."

 

  echo "<td align = 'center'>".$statementdate."</td>";

should do it.

 

Even simpler:

  echo "<td align = 'center'>".$row['statementdate']."</td>";

should do it, making the variables redundant.

 

Link to comment
Share on other sites

if you start the counter at 1, and increment after pulling out each row, counter will always be number_of_results+1.

 

so if you only pull out one row, counter will say 2.

 

(I'm just saying, maybe it's deliberate, in that case I apologize for buggin' you)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.