SunQuest
 
           General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old March 17th, 2003, 08:03 AM
mikethecow mikethecow is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 mikethecow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old April 22nd, 2003, 01:56 AM
avit avit is offline
Not Yet Perfect
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Squamish, BC
Posts: 111 avit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to avit
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > INSERT into relational db problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway