我在下面第49行收到的错误是代码行
确切错误
解析错误:语法错误,意外T_NEW,期待','或';'在第49行的/home/banking/onlinebanking/processdeposit.php
enter code here
<?php
require_once('../header.inc.php');
require_once('../class/database.class.php');
require_once('../class/person.class.php');
require_once('../websiteconfig.inc.php');
require_once('../class/bankaccount.class.php');
/*Start Session*/
session_start();
$currentMember = unserialzed($_SESSION['currentMember']);
/*Initialize variables*/
$depositamount = $_POST['depositamount_dollars'] . '.' . $_POST['depositamount_cent'];
$account = $_POST['account'];
$errors[]=array();
/*Error Handling*/
if($depositamount_dollars==''){
$errors[] = 'Please enter a valid dollars amount for your deposit.';
}
/*Error Handling*/
if($depositamount_cents==''){
$errors[] = 'Please enter a valid cents amount for your deposit.';
}
if($account==0){
$errors[] = 'Please select an account.';
}
/*Check if errors exist*/
$db = new Database;
$bankaccount = new Bankaccount;
$bankaccount->connection =$db->connection;
/*Process Deposit*/
$newbalance = $bankaccount->deposit($currentMember->memberid, $account, $depositamount);
echo '<h3>Deposit Completed</h3>' . "\n";
以下是第49行
echo '<p>A deposit of ' .money_format('%i' , $depositamount) . 'to Account #' .$account . ' .The new balance is: ' . money_format('%i' , $newbalance) . '.</p>';
} else {
echo '<h1>Deposit Errors!</h1>' . "\n";
echo '<ul id="error_list">' . "\n";
foreach($errors As $errors) {
}
echo '</ul>';
}
?>
答案 0 :(得分:1)
如果您错过了“;” ,那么错误通常在上面一行。
答案 1 :(得分:1)
if
块似乎没有else
声明。