(t_constant_encapsed_string)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bytM3
    New Member
    • May 2021
    • 6

    (t_constant_encapsed_string)

    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_ENC APSED_STRING) on line 62.
    Please advise. Thanks!
    Code:
    <!DOCTYPE html><html>
    <body><center>
    <img src="apt-pic.jpg" alt="apartment" height=75 width=200><br>
    For:<SELECT name="options">
    <option value="#990033" style="background-color: Violet;">Rent payment</option>
    <option value="#003300" style="background-color: Aquamarine;">Background Check</option>
    <option value="#6600cc" style="background-color: Pink;">Security Deposit Payment</option>
    <option value="#003300" style="background-color: Aquamarine;">Damages Payment</option>
    <option value="#990033" style="background-color: Violet;">Late Charges Payment</option>
    <option value="#003300" style="background-color: Aquamarine;">Court Costs Payment</option>
    <option value="#6600cc" style="background-color: Pink;">NSF Payment</option>
    <option value="#990033" style="background-color: Violet;"> </option>
    </SELECT><br>
    
    <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Name" value="Business Name -">
    <input type="text" size = 25 STYLE="color: #000000; background-color: #D4D4FF;" name="Addy1" value="Business address -">
    <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="Addy2" value="City, State, Zip"><br>
    
    <?php
    $link = mysqli_connect("localhost", "root", "", "prerentdb");
    // Check connection
    if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
    
    $unit = $_POST['unit'];
    $amtpaid = $_POST['amtpaid'];
    $hudpay = $_POST['hudpay'];
    $prevbal='prevbal';
    $latechg='latechg';
    $secdep='secdep';
    $damage='damage';
    $courtcost='courtcost';
    $nsf='nsf';
    $paidsum='paidsum';
    $receiptno='receiptno';
    $id='id';
    $due=due';
    
    <b> tenant paying is: <?php echo $_POST["unit"]; ?> -
    Amount paid is: <?php echo $_POST["amtpaid"]; ?><br>
    
    <input type="text" size = 75 STYLE="color: #000000; background-color: #D4AAFF;" name="sign" value="Sign here">
    <input type="text" size = 25 STYLE="color: #000000; background-color: #D4AAFF;" name="thanks" value="We Thank You"><br>
    
    <?php
    // Attempt select query execution
    $result = mysqli_query($link,"SELECT * FROM payfile");
    $results= $results->fetch_all(MYSQLI_ASSOC);
    
    $due = $prevbal + $latechg + $secdep + $damage + $courtcost + $nsf;
    $due = $due + $amtdue; $amtpaid = $paidsum;
    
    // if no payment or partial payment, add $10 to latechg field
    // and amount not paid to prevbal field
    if ($amtpaid < $due)
    { $latechg = $latechg + 10; $prevbal = $due - $amtpaid;  }
    
    // if payment = amtdue clear due
    if ($amtpaid == $due)
    { $prevbal = $latechg = $secdep = $damage = $courtcost = $nsf = 0; }
    // if over-payment subtract over-payment from prevbal field
    if ($amtpaid > $due )
    { $prevbal = $due - $amtpaid; $latechg = $secdep = $damage = $courtcost = $nsf = 0; }
    
    // Perform a query, check for error
    $sql = "UPDATE payfile SET
    amtpaid='$amtpaid', prevbal='$prevbal', latechg='$latechg', secdep='$secdep', damage='$damage',
    courtcost='$courtcost', nsf='$nsf', hudpay='$hudpay', datepaid='$datepaid', paidsum='$amtpaid',
    comments='$comments'
    Where unit = $unit"; // ********* this seems to be the culprit ************
    
    if ($link->query($sql) === TRUE) { echo "Paid"; } 
    else { echo "Error updating record: " . $link->error; 
    }
    
    </b></center></body></html>
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    Code:
    $due=due';
    Probably a syntax error on line 36. Also, I think there should be a closing tag ( ?> ) after that.

    Comment

    Working...