Jump to content

Recommended Posts

Hi Chaps, something rather easy (i presume), but its something that ive never done before.

 

When i want to delete a record a go to a new php file and use;

 

<?php require_once('../Connections/*.php'); ?>
<?php
mysql_select_db($database_*, $*);
$query_deleterecord = "DELETE FROM links WHERE id=". $_GET['ID'];
$deleterecord = mysql_query($query_deleterecord, $*) or die("MYSQL _Error: ".mysql_error());
?>

 

however, how can i delete 2 records with the same id?

For example i want to delete  record/s from 'links' and delete record/s from 'pagelinks' WHERE links.linkid AND pagelinks.linkid = ID (sent from original page)

 

Note, the structure for the pagelinks is

CREATE TABLE `pagelinks_en` (
  `pageid` int(11) NOT NULL default '0',
  `linkid` int(11) NOT NULL default '0',
  PRIMARY KEY  (`pageid`,`linkid`),
  KEY `linkid` (`linkid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

Thanks in advance

 

b

 

Link to comment
https://forums.phpfreaks.com/topic/105394-delete-two-records-from-db/
Share on other sites

Cheers Mate

 

Sorry, after i posted i realised that i needed to delete from 3 recaords rather than 2!

 

What ive written is;

 

$query_deleteguest = "DELETE links.linkid, pagelinks.linkid, eventlinks.linkid FROM links LEFT JOIN pagelinks on links.linkid = pagelinks.linkid LEFT JOIN eventlinks on links.linkid = eventlinks.linkid WHERE links.linkid=". $_GET['ID'];

 

but i get an error about my syntax...any thoughts?

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.