Hi
I am building an admin backend script where data can be added, updated and deleted and just working on the view customers coding at the mo, it all works and I have got the data displayed from the database but am trying to add edit and delete links but am getting the following errors
Notice: Undefined index: id in /home/sites/it-doneright.co.uk/public_html/admin/view-customers.php on line 78
“>Edit
Notice: Undefined index: id in /home/sites/it-doneright.co.uk/public_html/admin/view-customers.php on line 79
” onClick=”return confirm(‘.”‘Are you sure you want to delete this record?’);”.'”>Delete
The coding I have is below
[code=php]
<?php
$con= mysqli_connect(“localhost”, “username”, “password”, “dbname”);
if(!$con)
{
die(‘not connected’);
}
$con= mysqli_query($con, “SELECT plans_name, machine1, machine2, machine3, machine4, machine5, customer_name, customer_email, customer_phone, DATE_FORMAT(date_purchased_plan, ‘%d/%m/%Y’) AS date_purchased_plan from plans”);
?>
<div>
<td>Customers</td>
<table>
<th>Support Plan</th>
<th>Machine 1</th>
<th>Machine 2</th>
<th>Machine 3</th>
<th>Machine 4</th>
<th>Machine 5</th>
<th>Customer Name</th>
<th>Customer Email</th>
<th>Customer Phone</th>
<th>Plan Purchase Date</th>
<th colspan=”2″>Actions</th>
</tr>
<?php
while($row= mysqli_fetch_array($con))
{
?>
<tr>
<td><?php echo $row[‘plans_name’]; ?></td>
<td><?php echo $row[‘machine1’]; ?></td>
<td><?php echo $row[‘machine2’]; ?></td>
<td><?php echo $row[‘machine3’] ;?></td>
<td><?php echo $row[‘machine4’] ;?></td>
<td><?php echo $row[‘machine5’] ;?></td>
<td><?php echo $row[‘customer_name’] ;?></td>
<td><?php echo $row[‘customer_email’] ;?></td>
<td><?php echo $row[‘customer_phone’] ;?></td>
<td><?php echo $row[‘date_purchased_plan’];?></td>
<td><a href=”edit-customer.php?id=”<?php echo $row[“id”] ?>”>Edit</a></td>
<td><a href=”delete.php?id=”<?php echo $row[“id”] ?>” onClick=”return confirm(‘.”‘Are you sure you want to delete this record?’);”.'”>Delete</a></td>
</tr>
<?php
}
?>
</table>
</div>
Just seeing if someone can help me and see where I am going wrong
I have tried googling it and added in following coding above the SELECT query but didn’t seem to work so removed it again
[code=php]
$id = ”;
Thank you in advance
Ian