You could try to put the php code that pulls the data from the database on top of the table as $row is not defined when it is accessed.
Could you var_dump() of dd() the result of the query?, so we can see of the result is correct.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
And I'm so sorry guys I'm new in php, but & can't show the data in data base, please need advise. I can't know where's the issue exactly. I wanted to post this question on stackoverflow.com, but there's an issue to post it, & I need answer urgent please about this question
<html>
<head>
<title>Admin Page</title>
<style>
table{
font-family: arial,sans-serif;
border-collapse: collapse;
width: 100%;
}
td,th{
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even){
background-color: #dddddd;
}
</style>
</head>
<body>
<center><u><h1>Admin Tickets</h1></u></center>
<center>
<input type="text" name="text">
<input type="button" value="Search ticket#"></br></br>
</center>
<table>
<th>Ticket NO.</th>
<th>Phone</th>
<th>Subject</th>
<th>Description</th>
<th>Status</th>
<th>Created Date</th>
<th>Assign to</th>
<th>Closed Date</th>
<th> </th>
<tr>
<td><label for="ticketID" value='<?php echo $row['phone']; ?>'></td>
<td><label for="phone"><?php echo $row['phone']; ?></td>
<td><label for="subject"><?php echo $row['subject']; ?></td>
<td><label for="descreption"><?php echo $row['descreption']; ?></td>
<td>
<select>
<option value="open">Open</option>
<option value="hold">On hold</option>
<option value="resolved">Resolved</option>
<option value="closed">Close</option>
<?php echo $row['status']; ?>
</select>
</td>
<!--<td><input type="text" name="status"><?php echo $row['status']; ?></td>-->
<td><label for="createdDate"><?php echo $row['createdDate']; ?></td>
<td>
<select>
<option value="empty"> </option>
<option value="HD">Help Desk</option>
<option value="SA">System Admin</option>
<option value="voice">Voice</option>
<option value="noc">NOC</option>
<?php echo $row['assignedTo']; ?>
</select>
</td>
<td><label for="closed"><?php echo $row['closedDate']; ?></td>
<td><center><input type="button" value="OK"></center></td>
</tr>
</table>
<?php
//include('connect.php');
$id=$_GET['id'];
$db=mysqli_connect('localhost','root','','task') or die('Error connecting to MySQL Server.');
$query="SELECT tickets.ticketID,tickets.phone,tickets.subject,tickets.descreption,details.status,details.assignedTo FROM tickets,details WHERE tickets.ticketID=details.ticketID";
mysqli_query($db,$query) or die('Error querying database.');
$result=mysqli_query($db,$query);
$row=mysqli_fetch_array($result);
myqli_close($db);
?>
</body>
</html>
-so I need to show the data from DB & make the page save on the table.
Please or to participate in this conversation.