Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Linking fields in a database (http://www.programmingforums.org/showthread.php?t=15025)

mattireland Jan 24th, 2008 4:20 PM

Linking fields in a database
 
Hi,

I've been looking all over for how to do this but unfortunately haven't been able to find anything... I really hope you can help me please!

I've used navicat to create my database and i've linked two fields: category from table photos and id_cat from table categories - or at least tried to - i think it's worked!

So next, I want to create a drop down menu on my page to display a list of categories (I can do this :) ) and then I want to make it so that when the user submits the form, they will see a list of things from table photos with that id displayed below (this is the bit i'm having trouble with!)

Thanks very, very much and if you need clarification please do say!

Matt. I

grimpirate Jan 24th, 2008 8:15 PM

Re: Linking fields in a database
 
I don't understand much about manipulating databases Matt, but if you can retrieve the photos and their respective ids into some variable in your script all you would need to do is set up a form using the POST method for instance, and then check that the category they submitted exists. If it does go to that category, retrieve your info from the database and output it in whatever format you like. So is it the actual $_POST array you're having trouble with? Or outputting the images/text? Can you retrieve the data you created at all?

Syntax_Error Jan 24th, 2008 10:39 PM

Re: Linking fields in a database
 
Yeah, please be more specific exactly where your problem is. You should be able to take the post data, run some variable thats connected to the database through a query, and get the results formatted and outputted. Where exactly is the problem?

mattireland Jan 25th, 2008 4:10 AM

Re: Linking fields in a database
 
Sorry, I didn't realise it was that simple! I just did that!

Sorry for being such a noob and thank you very much!

kishou Jan 27th, 2008 6:28 PM

Re: Linking fields in a database
 
you can use JOIN/UNION
http://www.w3schools.com/sql/sql_join.asp

mattireland Jan 28th, 2008 2:11 AM

Re: Linking fields in a database
 
Navicat does that nicely for you but thanks!

It might actually be easier to do it by hand though!

Thanks again!

Matt. I


All times are GMT -5. The time now is 3:59 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC