Question : DELETE function MYSQL database

I use this same code changing just the table names for another script and works fine. I get no errors, but the records are not removed.....? Anyone help me with some ideas why?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
include 'pmheader.php';
require_once "dbpmconfig.php";
 
$id = ($_GET['id']);
 
$sql = "DELETE FROM subcontract WHERE id=$id";
$sql2 = "DELETE FROM table_bb WHERE id=$id";
 
echo $id;
 
$res  =  mysql_query($sql,$mysql);
$res2 =  mysql_query($sql2,$mysql);
$link =  "Return";
 
//deleting commitment from database
if ($res == TRUE) {
            echo "
"; echo "Your request has been sent.
"; } else { printf("There was an error in your request. Please contact support and reference: %s\n", mysql_errno($mysql)); } //deleting scomments from database if ($res2 == TRUE) { echo "
"; echo "Your request has been sent.
"; } else { printf("There was an error in your request. Please contact support and reference: %s\n", mysql_errno($mysql)); } ?> Back
Open in New Window Select All

Answer : DELETE function MYSQL database

>angellIII: type of data is varchar
then you need quotes:
1:
2:
3:
$sql = "DELETE FROM subcontract WHERE id='$id' ";
$sql2 = "DELETE FROM table_bb WHERE id='$id' ";
 
Open in New Window Select All
Random Solutions  
 
programming4us programming4us