Q:

deleting data from two tables

i'm trying to delete data from two tables, the first table(maklumatakaun) has "id" as its primary key and 2nd table(detailakaun) has id as its foreign key. right now my query lead to an error #1064
$idURL = $_GET['id'];

$query = "DELETE FROM detailakaun
          INNER JOIN maklumatakaun 
          WHERE maklumatakaun.id = detailakaun.id
          AND id = '$idURL'";

i echo the data id with this code
<a href="buang_akaun.php?id=<?php echo $id;?>

does anybody know how to do this?
EDIT: THE ERROR MESSAGE

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN maklumatakaun WHERE maklumatakaun.id = detailakaun.id AND id = '53'' at line 1

EDIT NEW ERROR
detailakaun has its own A.I id which is idDetail, and inside table detailakaun there are column NoTelefon , KodLokasi and KodJenisAkaun which can have more than one under one identical maklumatakaun.id , now my problem is i can't delete if there's more than one

A:

If you join you need an ON clause and when joining in a delete then you need to specify from which table you delete
DELETE m, d
FROM detailakaun d
INNER JOIN maklumatakaun m ON m.id = d.id
WHERE d.id = '$idURL'

