0

Hi i am Trying to delete a page from my site cms

and something is not working .

the code is:

<?php
 $con = mysql_connect("localhost","matanc_cmd","123123");
 if (!$con)
   {
   die('Could not connect: ' . mysql_error());
   }

mysql_select_db("matanc_cms", $con);


$id = (int) $_POST['id'];

mysql_query("DELETE FROM content WHERE id='$id'");
mysql_close($con);


// if successfully updated.
if($result){

echo "Successful";

 echo "<BR>";
 echo "<a href='show.php'>View result</a>";
}



 ?> 

What is wrong ?
when i want to delete a page i go to the delete.php?id=XX (XX = ID of the page)

Edited by matanc244

3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by pritaeas
0

Have PHP tell you what mysql doesn't like:

if($result) {
  // echo success info
}  else {
    echo mysql_errno($con) . ": " . mysql_error($con). "\n";
}
0

OK. Try putting this test before the if($result)... test.

if (mysql_errno()) { 
   $error = "MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When executing:<br>\n$query\n<br>";
}
0

when i want to delete a page i go to the delete.php?id=XX (XX = ID of the page)
$id = (int) $_POST['id'];

This should be

$id = (int) $_GET['id'];

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.