List:General Discussion« Previous MessageNext Message »
From:Jule Slootbeek Date:June 7 2002 10:59pm
Subject:inserting values w/ relationships
View as plain text  
Hey gang,
	I have two tables:

user
+------------+------------------+------+-----+---------+---------------+
| Field      | Type             | Null | Key | Default | Extra         |
+------------+------------------+------+-----+---------+---------------+
| user_id    | int(10) unsigned |      | PRI | NULL    | auto_increment|
| first_name | varchar(10)      |      |     |         |               |
| last_name  | varchar(20)      |      |     |         |               |
| email      | varchar(100)     |      |     |         |               |
| username   | varchar(16)      |      |     |         |               |
| password   | varchar(32)      |      |     |         |               |
+------------+------------------+------+-----+---------+---------------+

and

quiz
+---------+------------------+------+-----+---------+----------------+
| Field   | Type             | Null | Key | Default | Extra          |
+---------+------------------+------+-----+---------+----------------+
| quiz_id | int(10) unsigned |      | PRI | NULL    | auto_increment |
| user_id | int(10) unsigned |      |     | 0       |                |
| title   | varchar(255)     |      |     |         |                |
+---------+------------------+------+-----+---------+----------------+

now user_id and is a relationship between user and quiz...
How do i make sure that when i insert a new row into quiz that user_id
gets taken from quiz, without me having to look it up in user and
entering it manually?
any ideas?

Jule
--
Jule Slootbeek	
jslootbeek@stripped

http://blindtheory.cjb.net

( sql, query )
	


Thread
inserting values w/ relationshipsJule Slootbeek8 Jun
  • Re: inserting values w/ relationshipsDan Nelson8 Jun