I'm making a technical evaluation system for the company I worked. when I uploaded it to online host there's some error "Array string conversion".
Notice: Array to string conversion in /storage/ssd5/805/10576805/public_html/UI/data.php on line 4 Notice: Undefined property: UserData::$Array in /storage/ssd5/805/10576805/public_html/UI/data.php on line 4 Fatal error: Uncaught Error: Function name must be a string in /storage/ssd5/805/10576805/public_html/UI/data.php:4 Stack trace: #0 {main} thrown in /storage/ssd5/805/10576805/public_html/UI/data.php on line 4
I tried to run the program in PHP5 down to an older version of PHP it is worked. But in PHP7 to newest version doesn't work. I think there is the new syntax for array conversion of PHP7. can you help me please to fix this problem? Thanks a lot.
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>