dch27 Posted June 12, 2008 Share Posted June 12, 2008 my web host is running MYSQL 3.23, 4.0, 4.1. I don't know which. (godaddy) They have a web gui that lets u create tables. It also has an sql query window. I have two tables. members & users. users has everybody that signs up for the sight, members are users that are affiliated. I need a field in members to be called 'userID' and it needs to reference 'users'. how? create table members ( userID not null references users ) does not work. can i use triggers? if so, how? Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/ Share on other sites More sharing options...
fenway Posted June 12, 2008 Share Posted June 12, 2008 First, find out which version you're running. Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-564090 Share on other sites More sharing options...
dch27 Posted June 12, 2008 Author Share Posted June 12, 2008 4.1 Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-564175 Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 OK... now what do you mean by "doesn't work"... generates an error, doesn't act the way you expect, etc.? I see no ON UPDATE / ON DELETE... Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-564757 Share on other sites More sharing options...
dch27 Posted June 13, 2008 Author Share Posted June 13, 2008 What I mean by doesn't work: create table member ( memberID integer primary key, userName not null references users, ); #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'not null references users, )' at line 3 I want the userName to be pulled out of the users table. Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-565063 Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 Maybe because you're missing the column type?!?!? Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-565100 Share on other sites More sharing options...
dch27 Posted June 13, 2008 Author Share Posted June 13, 2008 yea i think that was it. working now. forgive me Link to comment https://forums.phpfreaks.com/topic/109828-solved-mysql-references-users-does-not-work/#findComment-565112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.