Hi im trying to add a delete page to my database but i get some error messages when i use the code below. I use two pages admin.php and delete.php.
I cant find the problem so it would be good if anybody could help me out.
/ Lisa
For this page i get error message
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 14
admin.php
<?// Connect database
include("connectdb.php");
// Get all records in all columns from table and put it in $result.
$result=mysql_query("select * from phonebook");
/Split records in $result by table rows and put them in $row.
Make it looping by while statement. /
while($row=mysql_fetch_assoc($result)){
// Output
echo "id : $row['id'] <br/>";
echo "namn : $row['name'] <br/>";
echo "email : $row['email'] <br/>";
echo "tel : $row['tel'] <hr>";
// Add a link with a parameter(id) and it's value. This for update record at update.php
echo '<a href="update.php?id='.$row['id'].'">Update</a>';
// Add a link with a parameter(id) and it's value. This for delete record at delete.php
echo '<a href="delete.php?id='.$row['id'].'">Delete</a>';
}
mysql_close();
?>
for this page i get errormessage Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
delete.php
<?
// Connect database.
include("connectdb.php");
// Get values from form.
$id=$_GET['id'];
// Do delete statement.
mysql_query("delete from phonebook where id='$id'");
// Close database connection
mysql_close();
// Redirect to admin.php.
header("location:admin.php");
?>