Jump to content

Simple Calculations


DrTrans

Recommended Posts

What I'm trying to do is basically keep a record of numbers with a balance kinda like a check ledger.

 

current code


$query = "SELECT * FROM payments WHERE propid = '$propid' ORDER BY pay_date DESC ";
        $result = mysql_query($query);
        while($row = mysql_fetch_assoc($result))
	{
	        $pay_id		 	= $row['id'];
		$pay_message   		= $row['pay_message'];
		$pay_smessage 	    = substr($pay_message,0, 15);
		$pay_who 		= $row['pay_who'];
		$pay_date 		= $row['pay_date'];	
		$pay_amount		= $row['pay_amount'];	
		$pay_controller = $row['pay_controller'];						

		if($pay_controller == "-") {

			$fontcolor = "red";
		} 
		if($pay_controller == "+") {

		   $fontcolor = "black";
		}

	   	



print"<tr  onMouseOver=\"this.bgColor = '#CEE3F6'\" onMouseOut =\"this.bgColor = '#FFFFFF'\">
<td onclick=\"window.alert('Username: $pay_who Message: $pay_message')\">$pay_id</td><td>$pay_who</td><td>$pay_date</td><td><font color=\"$fontcolor\">$$pay_amount</font></td><td>$$balance</td>

";

 

I know its dirty..

 

 

I can make it show the results from the db, and mark them as Red and Black. now i need it to add and subtract them based on the pay_controller . Can someone please help.

Link to comment
https://forums.phpfreaks.com/topic/263230-simple-calculations/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.