2011-04-16 115 views
0

这是我的错误 - 它有我忽略的东西不知道它在哪里。PHP编码错误

解析错误:语法错误,在/home/mjcrawle/public_html/cit0215/assignment5/onlinebanking/viewaccounts.php意想不到的$结束上线107

问候

<?php 

require_once('footer_nav/navigation.inc.php'); 
require_once('../websiteconfig.inc.php'); 
require_once('/class/person.class.php'); 
require_once('../class/database.class.php'); 

/*Start Session*/ 
session_start(); 

$currentMember =usserialize($_session['currentMember']); 

/*DataBase*/ 
$db = new Database; 
$conn = $db->connection; 
?> 
<td width="16">&nbsp;</td> 
<td width="595"> 
</td> 
</tr> 

</div> 


<h2>Accounts</h2> 


</td> 
<table id="accounts" summary="Bank Account Balance Information"> 
<thread> 
    <tr> 
     <th>Account Number</th> 
     <th>Account Balance</th> 
    </tr> 
    </thead> 
<tbody>  
<? 
/*Accounts*/ 
$currentMember->connection = $conn; 
$account = $currentMember->retrieve_all_accounts(); 

/* Loop Though Accounts*/ 
while($acount = mysqli_fetch_assoc($acount)) { 
/* Retrieve Account Balance*/ 
$bankaccount = new Bankaccount ($account['BankAccountID']); 
$bankaccount->connection = $conn; 
$balance = mysqli_fetch_assoc($bankaccount->retrieve_current_balance()); 

echo '<tr>' . "\n"; 
echo "\t" . '<td class="account_number">' . $account['BankAccountID'] . '</td>' . "\n"; 
echo "\t" . '<td class="account_balance">$' . number_format($balance['CurrentBalance'], 2) . '</td>' . "\n"; 
echo '</tr>' . "\n"; 

/*Closed DataBase*/ 
mysqli_close($db->connecion); 
} 
?> 
+8

'while($ acount = mysqli_fetch_assoc($ acount)){'真的吗?! – 2011-04-16 04:09:22

+0

这不是完整的来源。你能告诉我们107号线吗? – 2011-04-16 04:13:05

+0

线107很可能在代码 – Steve 2011-04-16 04:14:25

回答

1

看起来while循环不会被关闭。

while($acount = mysqli_fetch_assoc($acount)) { 

无论是或者您正在提前关闭数据库连接。 (while循环内)

这是因为据我可以根据您在这里包含的代码告诉。

尝试后

echo '</tr>' . "\n"; 

结束while循环,并看看是否有帮助。

+0

不,它已关闭。另外,过早关闭数据库不会有任何与语法错误有关的事情。 – 2011-04-16 04:18:05

+0

我一直在想,直到它被添加:) – 2011-04-16 04:18:09

+0

是的,这是学校。这与商业用途无关。 – 2011-04-16 04:22:16

2

这样做:

一次删除一个包含的类,看看其中一个是否是原因。

我的猜测是,你会发现一个{而没有匹配的}在其中的一个

0

最后一次关闭后的尾回车?>