Link to home
Start Free TrialLog in
Avatar of sabecs
sabecs

asked on

Update a MySQL table via a form button?

Hi,
If I have a table as below, how would I update the table using PHP/MySQl/Javascript via an "add to friends" button?
Say if one id was "17" and the other was "46"

Thanks in advance for your feedback.


CREATE TABLE IF NOT EXISTS `friends` (
  `id` int(11) NOT NULL auto_increment,
  `toid` int(11) NOT NULL,
  `fromid` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `friends`
--

INSERT INTO `friends` (`id`, `toid`, `fromid`) VALUES
(1, 17, 2007),
(2, 2007, 17),
(3, 17, 11),
(4, 11, 17),
(5, 17, 26),
(6, 26, 17);
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sabecs
sabecs

ASKER

thanks for you feed back, I know how to insert the data, I need the code to execute the javascript required update my table via PHP.
Avatar of sabecs

ASKER

Thanks pratima_mcs for your help, just needed more information.