-
Notifications
You must be signed in to change notification settings - Fork 0
/
newinvoiceline.php
27 lines (20 loc) · 1.01 KB
/
newinvoiceline.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?
require_once("service-admin.inc.php");
$opts['tb'] = 'subscriptions';
$opts['sv'] = 'services';
$opts['in'] = 'invoicelines';
// Connect to database
mysql_connect($opts['hn'], $opts['un'], $opts['pw']);
mysql_select_db($opts['db']);
if(isset($_POST["addinvline"]) && ($_POST["customerid"]!=0) && (!empty($_POST["description"])) && (!empty($_POST["amount"])) && (!empty($_POST["charge"]))) {
// apparently we have been submitted, so lets update some records
$customerid = $_POST["customerid"];
$description = $_POST["description"];
$invoicelinedate = $_POST["invoicelinedate"];
$amount = $_POST["amount"];
$charge = $_POST["charge"];
$qry = "INSERT INTO ".$opts['in']." (customerid, description, invoicelinedate, amount, charge) VALUES ($customerid, '$description', '$invoicelinedate', $amount, $charge)";
$result = mysql_query($qry) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $qry . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
}
header('Location: itemstoinvoice.php');
?>