472,344 Members | 1,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 software developers and data experts.

(t_constant_encapsed_string)

6
Hi itsme again. I have this prob I can't get past. This is a program to pay a fee and print a receipt.
I enter the unit and payment into a form and get the message:
Parse error: syntax error, unexpected ''; ' (T_CONSTANT_ENCAPSED_STRING) on line 62.
Please advise. Thanks!
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html><html>
  2. <body><center>
  3. <img src="apt-pic.jpg" alt="apartment" height=75 width=200><br>
  4. For:<SELECT name="options">
  5. <option value="#990033" style="background-color: Violet;">Rent payment</option>
  6. <option value="#003300" style="background-color: Aquamarine;">Background Check</option>
  7. <option value="#6600cc" style="background-color: Pink;">Security Deposit Payment</option>
  8. <option value="#003300" style="background-color: Aquamarine;">Damages Payment</option>
  9. <option value="#990033" style="background-color: Violet;">Late Charges Payment</option>
  10. <option value="#003300" style="background-color: Aquamarine;">Court Costs Payment</option>
  11. <option value="#6600cc" style="background-color: Pink;">NSF Payment</option>
  12. <option value="#990033" style="background-color: Violet;"> </option>
  13. </SELECT><br>
  14.  
  15. <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Name" value="Business Name -">
  16. <input type="text" size = 25 STYLE="color: #000000; background-color: #D4D4FF;" name="Addy1" value="Business address -">
  17. <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Addy2" value="City, State, Zip"><br>
  18.  
  19. <?php
  20. $link = mysqli_connect("localhost", "root", "", "prerentdb");
  21. // Check connection
  22. if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
  23.  
  24. $unit = $_POST['unit'];
  25. $amtpaid = $_POST['amtpaid'];
  26. $hudpay = $_POST['hudpay'];
  27. $prevbal='prevbal';
  28. $latechg='latechg';
  29. $secdep='secdep';
  30. $damage='damage';
  31. $courtcost='courtcost';
  32. $nsf='nsf';
  33. $paidsum='paidsum';
  34. $receiptno='receiptno';
  35. $id='id';
  36. $due=due';
  37.  
  38. <b> tenant paying is: <?php echo $_POST["unit"]; ?> -
  39. Amount paid is: <?php echo $_POST["amtpaid"]; ?><br>
  40.  
  41. <input type="text" size = 75 STYLE="color: #000000; background-color: #D4AAFF;" name="sign" value="Sign here">
  42. <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="thanks" value="We Thank You"><br>
  43.  
  44. <?php
  45. // Attempt select query execution
  46. $result = mysqli_query($link,"SELECT * FROM payfile");
  47. $results= $results->fetch_all(MYSQLI_ASSOC);
  48.  
  49. $due = $prevbal + $latechg + $secdep + $damage + $courtcost + $nsf;
  50. $due = $due + $amtdue; $amtpaid = $paidsum;
  51.  
  52. // if no payment or partial payment, add $10 to latechg field
  53. // and amount not paid to prevbal field
  54. if ($amtpaid < $due)
  55. { $latechg = $latechg + 10; $prevbal = $due - $amtpaid;  }
  56.  
  57. // if payment = amtdue clear due
  58. if ($amtpaid == $due)
  59. { $prevbal = $latechg = $secdep = $damage = $courtcost = $nsf = 0; }
  60. // if over-payment subtract over-payment from prevbal field
  61. if ($amtpaid > $due )
  62. { $prevbal = $due - $amtpaid; $latechg = $secdep = $damage = $courtcost = $nsf = 0; }
  63.  
  64. // Perform a query, check for error
  65. $sql = "UPDATE payfile SET
  66. amtpaid='$amtpaid', prevbal='$prevbal', latechg='$latechg', secdep='$secdep', damage='$damage',
  67. courtcost='$courtcost', nsf='$nsf', hudpay='$hudpay', datepaid='$datepaid', paidsum='$amtpaid',
  68. comments='$comments'
  69. Where unit = $unit"; // ********* this seems to be the culprit ************
  70.  
  71. if ($link->query($sql) === TRUE) { echo "Paid"; } 
  72. else { echo "Error updating record: " . $link->error; 
  73. }
  74.  
  75. </b></center></body></html>
Aug 18 '21 #1
1 1797
dev7060
625 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. $due=due';
Probably a syntax error on line 36. Also, I think there should be a closing tag ( ?> ) after that.
Aug 22 '21 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.