edgarasm Posted November 5, 2013 Share Posted November 5, 2013 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 More sharing options...
Ch0cu3r Posted November 5, 2013 Share Posted November 5, 2013 I have replied to your original topic http://forums.phpfreaks.com/topic/283583-problem-with-my-code/ Link to comment https://forums.phpfreaks.com/topic/283625-colours-on-send-and-receive-money/#findComment-1457079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.