Ok so I ran into a problem, i have the following database schema
PHP Code:
CREATE TABLE `affiliations` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`mapquest` text NOT NULL,
`type` text NOT NULL,
`visid` text NOT NULL,
`address` text NOT NULL,
`phone` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=908 ;
CREATE TABLE `affiliations_usr` (
`id` int(11) NOT NULL auto_increment,
`visid` text NOT NULL,
`visname` text NOT NULL,
`cat` varchar(255) NOT NULL default '',
`name` text NOT NULL,
`date` varchar(255) NOT NULL default '0000-00-00',
`start` varchar(255) NOT NULL default '0000-00-00',
`end` varchar(255) NOT NULL default '0000-00-00',
`aff_id` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1363 ;
affiliation is listed with all affilliations and affiliations_usr lists who is affilliated with those users. I have a script that finds all users affiliated with a certain affiliation.
I recently discovered a programming error on my part, for some reason I cannot search text with a ' in it for intance 'St. John\'s Prayer Club' because it wont find it at all... I read something about it and it said that the ' is treated like a seperate word. So after trying 100 different queries to find the name in the database I decided to use the id instead (btw if know of a way i can search with a ' then please let me know)
So i put in aff_id, but now i have 1000 entries with no aff_id, what im wondering is...
is there a way to go through all entries in affiliations_usr take the name field and compare it to affiliations (which are all in there) then take the id of that exact affilliation then go back and populate the affiliation_usr field with that id number?
Any help would be appreciated, if you dont understand something please let me know.