PRodgers4284 Posted March 16, 2008 Share Posted March 16, 2008 Im want to delete records from two tables, the tables are called "employers" and "job". I am want to delete records based on the username in each table. Im using the following query but im not sure if the syntax is correct for deleting from two tables: mysql_query("DELETE FROM employers && job WHERE username='$username'"); Can anyone help? Quote Link to comment Share on other sites More sharing options...
Barand Posted March 16, 2008 Share Posted March 16, 2008 DELETE FROM employers e , job j WHERE e.username = j.username AND e.username = '$username' Quote Link to comment Share on other sites More sharing options...
PRodgers4284 Posted March 16, 2008 Author Share Posted March 16, 2008 Hey thanks for the reply, i tried the query you suggested, but it doesnt same to be deleting the records, below is the php code I have now: <?php $username = $_GET['username']; if (isset($_POST['submit'])) { mysql_query("DELETE FROM employers e , job j WHERE e.username = j.username AND e.username = '$username'"); ?> <br /> <a href="Indexadmin.php">Back to main page</a> <br /> <br /> <br /> The Employer account for <b><?php echo $username; ?></b> has been deleted from the system <?php } else { $account = mysql_fetch_array(mysql_query("SELECT * FROM employers WHERE username='$username'")); ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted March 16, 2008 Share Posted March 16, 2008 One question comes to mind If you are POSTing data, why is username coming from GET Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.