Jump to content

Colours on send and receive money


Go to solution Solved by Ch0cu3r,

Recommended Posts

hi all im trying to colour the money in and out .Bascally if the money was sent to someone i want to colour the balance or money sent in red

 

and if the money was received i would want the received balance to be green with a plus sigh 

 

any ideas 

 

my code is below 

 

<?php include '../header.php'; ?>

	<div id="title">
		<div class="inner">
			<ol class="breadcrumb">
				<li><a href="index.php">Home</a></li>
				<li>My Account - Transactions</li>
			</ol>
			<h1>My Account - Transactions</h1>
		</div>
	</div>

	<div id="content" class="right-sidebar">
		<div class="inner">
			<div id="main" role="main">
				
				<?php 
				
				$results = mysql_query("SELECT T.`date`, CONCAT(A.first_name, ' ', A.`last_name`) AS `from`, CONCAT(AA.first_name, ' ', AA.`last_name`) AS `to`, T.`amount`, T.`from_id`, T.`account_id` FROM `transactions` T JOIN `users` A ON (T.`from_id` = A.`id`) JOIN `users` AA ON (T.`account_id` = AA.`id`) WHERE (T.`account_id` = '" . $_SESSION['account_id'] . "' || T.`from_id` = '" . $_SESSION['account_id'] . "') ORDER BY T.`id` DESC") OR die(mysql_error());
				
				?>
				
				<div class="container">
					<h2>Transactions</h2>
					<table class="table">
						<tr>
							<th>Type</th>
							<th>Date</th>
							<th>Name</th>
							<th>Amount</th>
						</tr>
						<?php if(mysql_num_rows($results) == 0){ ?>
							<tr>
								<td colspan="4">No transactions</td>
							</tr>
						
						<?php } else { ?>
							
							<?php while($row = mysql_fetch_array($results)){ ?>
							<tr>
								<td><?php echo ($row['from_id'] == $_SESSION['account_id'] ? "Sent" : "Received"); ?></td>
								<td><?php echo $row['date']; ?></td>
								<td><?php echo ($row['from_id'] == $_SESSION['account_id'] ? $row['to'] : $row['from']); ?></td>
								<td>£ <?php echo $row['amount']; ?></td>
							</tr>
							<?php } ?>
							
						<?php } ?>
					</table>
				</div>
				
				<div class="space"></div>
			</div>
			<ul class="sidebar" role="complementary">
				<li>
					<h2>Navigation</h2>
					<ul class="link-list">
						<li><a href="/account/dashboard.php">Dashboard</a></li>
						<li><a href="/account/transfer.php">Transfer Money</a></li>
						<li><a href="/account/transactions.php">Transactions</a></li>
						<li><a href="">Withdraw Funds</a></li>
						<li><a href="">Upload Funds</a></li>
						<li><a href="">Change My details</a></li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
<?php include '../footer.php'; ?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/283625-colours-on-send-and-receive-money/
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.