Jump to content

Deleting records from two tables


PRodgers4284

Recommended Posts

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?

Link to comment
Share on other sites

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'")); 

?>  

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.