Jump to content

Recommended Posts

the below code has worked for months but in modifying I got lost. below is the error message and code. I could use some help

 

Parse error: syntax error, unexpected 'calculate_paid' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\invoice\payment.php on line 63

 
<?php
mysql_connect('localhost','root',''); 
mysql_select_db('numbersdb') or die("Unable to select invcalc database");
$query = "SELECT taxrate from numbdata"; 
$result = mysql_fetch_assoc(mysql_query($query));

$taxrate = $result['taxrate'];  
mysql_connect('localhost','root','');
mysql_select_db('oodb') or die("Unable to select database");
$query = "SELECT id, shipamt, duedate, charges, dayslate, tax, amtdue FROM oocust  WHERE DATEDIFF(NOW(), duedate) > 30 AND amtdue > '0.00'";  
$result=mysql_query($query);
$num=mysql_numrows($result);
while($row = mysql_fetch_array($result))
  {
$id = $row['id'];
$shipamt = $row['shipamt'];  
$duedate = $row['duedate'];
$charges = $row['charges'];
$dayslate = $row['dayslate'];
$tax = $row['taxrate']; 
$amtdue = $row['amtdue'];	 
$tax = $charges * $rate;	
$amtdue = $charges + $tax + $shipamt;
$currdate = date('Y-m-d');
$date1 = $duedate;
$date2 = $currdate;
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
// echo "Difference is $months months, $days days.";
$dayslate = $months *30;
$dayslate = $dayslate + $days;
$sql = "UPDATE oocust SET
tax = '" . mysql_real_escape_string($tax) . "',
amtdue = '" . mysql_real_escape_string($amtdue) . "',
dayslate = '" . mysql_real_escape_string($dayslate) . "',
duedate = '" . mysql_real_escape_string($duedate) . "',
WHERE id='".$id."'";
mysql_query($sql) or die("Update query failed.");
}
echo "Invoice Prep completed";
mysql_close();
?>

Link to comment
https://forums.phpfreaks.com/topic/273670-help-with-php/
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.