|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
INSERT into relational db problem
I'm settin up a basic catalogue/ ecommerce site with a db structure along these lines:
table 'films' --------- title_id title etc... table 'genres' --------- genre_id genre table 'film_genre_links' --------- title_id genre_id I'm using PHP to display the relational info for each title on a page - this works okay. How do I do it in reverse? How do I insert title & genre id's into the link table using the genre names? Along the lines of "INSERT INTO film_genre_links (title_id,genre_id) VALUES ($title_id,$genre_id) WHERE genre.genre=$genre" Sorry if this is vague or on the wrong forum - newbie. The $variables relate to text boxes or check boxes on an html form I thank you |
|
#2
|
|||
|
|||
|
Your form variables are sent back to the server either by GET (as part of the URL) or by POST (as part of the request body). You can access these variables and do the INSERT query with them.
Since you're using PHP, you access your form elements thus: $genre = $_GET['genre']; or $genre = $_POST['genre']; Depending on how you've set up your form. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > INSERT into relational db problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|