I'm trying to delete a row in my mysql database. Which row to be deleted is defined by a _GET tag. So if the page URL is deletePage.php?id=5 it wil delete the row with ID=5.
Here is my code so far:
<?php
 if (empty($_GET)) {echo "Error!";}
 else {
    include "../../includes/dke390d-ko.php";
    $pageID = $_GET['id'];;
    $conn = mysql_connect($dbhost, $dbuser, $dbpasswd);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}
$sql = 'DELETE FROM page
        WHERE id="$pageID"';
mysql_select_db($dbname);
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not delete data: ' . mysql_error());
}
echo "Deleted data successfully\n";
mysql_close($conn);
    header("Location: index.php");
    }
 ?>
My problem is that when i execute the code i am getting a error message saying: Could not delete data: Unknown column 'id' in 'where clause'
I should probably put the ID in a session. But that'll come later.
Best regards!
 
     
    