Jump to content


Photo

help with php


  • Please log in to reply
2 replies to this topic

#1 kirkwebsites

kirkwebsites

    Newbie

  • New Members
  • Pip
  • 5 posts

Posted 26 January 2013 - 10:59 AM

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();
?>
 


#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 26 January 2013 - 11:02 AM

Post line 62-64.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#3 Barand

Barand

    Sen . ( ile || sei )

  • Gurus
  • 14,135 posts
  • LocationCheshire, UK

Posted 26 January 2013 - 02:14 PM

I counted 44 lines in that code so please post the message that goes with the code.

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
|baaSelect| generate js and php code for dynamic linked dropdowns

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com