Hello,
I am getting this error when trying to run this code:
PHP Parse error: syntax error, unexpected ';' in /home/wojtek/Desktop/work/delete1.php on line 59
Here is the code:
<!-- Delete Customer Page -->
<HTML>
<HEAD> <TITLE> Delete Customer Page> </TITLE> </HEAD>
<BODY>
<FORM action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
Deleting Customer Information Form.<br />
Select all customers you want to delete from the database:
<TABLE width="70%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width=5%></td>
<td><strong>ID</strong></td>
<td><strong>Customer</strong></td>
<td><strong>Contact</strong></td>
<td><strong>Phone</strong></td>
<td><strong>Alerts</strong></td>
<td><strong>Reports</strong></td>
<td><strong>Date</strong></td>
</tr>
<?php
mysql_connect("localhost", "analyst", "voyant");
mysql_select_db("voyant");
$query = "SELECT cust_id, cust_name, contact, phone, alert_email, report_email, date FROM customer ORDER BY cust_id";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
?>
<tr>
<td><input type="checkbox" name="<?php echo $row[cust_id]; ?>" value=""></td>
<td><?php echo $row[cust_name]; ?></td>
<td><?php echo $row[contact]; ?></td>
<td><?php echo $row[phone]; ?></td>
<td><?php echo $row[alert_email]; ?></td>
<td><?php echo $row[report_email]; ?></td>
<td><?php echo $row[date]; ?></td>
</tr>
<?php } ?>
</TABLE>
<input type="submit" name"submit" value="Delete Selected">
</FORM>
<?php
//Connect to the server and select the database
mysql_connect("localhost", "analyst", "voyant");
mysql_select_db("voyant");
//Checking if the form has been submited
if (isset($POST['submit']))
{
//Loop through each customer with selected checkbox
foreach($count=0; $count < count($POST['cust_id']); $count++)
{
$cust_id = $POST['cust_id'][$count];
$query = "DELETE FROM customer WHERE cust_id='$cust_id'";
$result = mysql_query($query);
//Making sure something was changed...
if ((mysql_affected_rows90 == 0) || mysql_affected_rows() == -1)
{
echo "<p> There was a problem deleting...</p>";
exit;
}
}
echo "<p> The selected clients were successfully deleted!</p>";
}
?>
End of Code.
Can someone please tell what might be a problem here? Many thanks in advance.
Edit by admin: no contact info permitted on the forum, thank you
Again thank you to anyone trying to help me here.