Jump to content

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

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.