Hello:
Here is an interesting question.
I have a client payment recording form which retrieves data from a table that has clients balances and other.
My task with this form is to take payments (which can be payments in full or partial payments). I need to be able to update the originating table with new payments as well as have the ability to record multiple payment to this account.
Not sure if this is doable with the existing table or will I need a separate table in conjunction with the initial table.
Currently I'm able to update the originating table in this way:
<?php
error_reporting(0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//error_reporting(E_ALL);
$host = "localhost";
$login_name = "23232";
$password = "23232242";
$link=mysql_connect("$host","$login_name","$password");
mysql_select_db("shop", $link);
//or die("Could not find database");
//echo mysql_errno() . ": " . mysql_error(). "\n";
// define each variable
if(isset($_POST['submit']))//this defines any variable that are not define below
{
$edit_sel_id = mysql_real_escape_string($_POST['edit_sel_id']);
$paymentamount = $_POST['paymentamount'];
$paymenttype = mysql_real_escape_string($_POST['paymenttype']);
$paymentref = mysql_real_escape_string($_POST['paymentref']);
$paymentdate = mysql_real_escape_string($_POST['paymentdate']);
$memo = mysql_real_escape_string($_POST['memo']);
$newbalance=$_POST['newbalance'];
$newbalance= "$".''.$newbalance;
$paymentamount= "$".''.$paymentamount;
if ($edit_sel_id == "") echo "! No identifier retrieved";
else
$mysql_query=("UPDATE billofservice SET newpayment_date=NOW(), newpayment_amount='$paymentamount', newpayment_type='$paymenttype',
paymentref='$paymentref', newpmtmemo='$memo', Balancedue='$newbalance' WHERE id=$edit_sel_id");
$result=mysql_query($mysql_query);
if(!$result){die("Error: ".mysql_error());
}
mysql_close($link);
}
?>
I need to figure out a plan when partial payments needs to be entered --as this current mechanism would replace exiting fields with new ones.
Any thoughts!
Mossa