我正在为我工作的公司建立一个技术评估系统。当我将其上传到在线主机时,出现了“数组字符串转换”错误。
注意:第4行的/storage/ssd5/805/10576805/public_html/UI/data.php中的数组到字符串的转换注意:未定义的属性:/ storage / ssd5 / 805/10576805 / public_html中的UserData :: $ Array第4行上的/UI/data.php致命错误:未捕获的错误:函数名称必须是/storage/ssd5/805/10576805/public_html/UI/data.php:4中的字符串:堆栈跟踪:#0 {main}被抛出/storage/ssd5/805/10576805/public_html/UI/data.php,第4行
我试图在PHP5中运行该程序,直到运行较旧版本的PHP。但是在PHP7中,最新版本不起作用。我认为有PHP7数组转换的新语法。您能帮我解决这个问题吗?非常感谢。
Data.php
<?php
$process = new UserData();
if(isset($_GET['q'])){
$process->$_GET['q'](); //this line have an error
}
class UserData {
function deletePending(){
require '../config.php';
$trans_no = $_GET['trans_no'];
$q = $connection->query("delete from tevaluation where TRANS_NO='$trans_no'");
return $q;
}
}
?>
View.php
<html>
<head>
<title>
Technical Evaluation
</title>
</head>
<body>
<?php
include 'data.php';
$data = $process->pendingEvaluation();
?>
<table class="table table-hover" id="itemList">
<thead class="bg-primary">
<tr>
<th class="text-center" width="35">TE #</th>
<th class="text-center" width="10">QUANTITY</th>
<th class="text-center" width="10">UNIT</th>
<th class="text-center" width="20">DESCRIPTION</th>
<th class="text-center" width="20">DEPARTMENT</th>
<th class="text-center" width="130">DATE EVALUATED</th>
<th class="text-center" width="50">STATUS</th>
<th class="text-center">ACTION</th>
</tr>
</thead>
<tbody>
<?php if($data->num_rows > 0): ?>
<?php while($row = mysqli_fetch_array($data)): ?>
<?php if($row['STATUS'] == 2):
$stat = "<p class='text-danger'><b> For Approval</b></p>";
?>
<tr>
<td class="text-center" width="15"><?php echo $row['TRANS_NO']; ?></td>
<td class="text-center" width="10"><?php echo $row['QTY']; ?></td>
<td class="text-center" width="10"><?php echo $row['UNIT']; ?></td>
<td class="text-center" width="40"><?php echo $row['DESCRIP']; ?></td>
<td class="text-center" width="20"><?php echo $row['DEPT']; ?></td>
<td class="text-center" width="130"><?php echo $row['E_DATE']; ?></td>
<td class="text-center" width="50"><?php echo $stat; ?></td>
<td>
<a href="data.php?q=deletePending&trans_no=<?php echo $row['TRANS_NO']; ?>" class="btn btn-danger btn-sm" title="Click to Delete">
<span class="fa fa-trash"></span><b> Delete</b>
</a>
</td>
</tr>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</tbody>
</table>
</body>
</html>