Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Reply
 
Topic Tools
  #1  
Old July 20th, 2004, 01:42 PM
jlee2301 jlee2301 is offline
New Member
 
Join Date: Jul 2004
Posts: 6
help with phpmyadmin please

Hi I am creating a website and linking it to a database using php and mysql. I need to create the databses in phpmyadmin and have decided on the structure of the tables in the database. However, as expected, there are foreign keys in some of the tables - does anyone know how to link the foreign key of one table into another table within phpmyadmin so the database works properly and can be queried using sql? Is it a case of using an sql command to alter the table? I would really appreciate help with this.
Thanks,
James
Reply With Quote
  #2  
Old July 20th, 2004, 05:23 PM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,042
Blog Entries: 1
Welcome

There is a SQL/Query window in phpmyadmin where you can directly enter the SQL code.
__________________
Cheers,
Degs

Please post back with your results
CTH Terms of Use

CTH Subscriptions :: Adaware Guide :: HijackThis
Reply With Quote
  #3  
Old July 21st, 2004, 12:05 PM
jlee2301 jlee2301 is offline
New Member
 
Join Date: Jul 2004
Posts: 6
Thanks - any ideas on the SQL to use?
Reply With Quote
  #4  
Old July 21st, 2004, 04:32 PM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,042
Blog Entries: 1
I'm not great on SQL.

Could you give an example of your table names and what you want to achieve?
__________________
Cheers,
Degs

Please post back with your results
CTH Terms of Use

CTH Subscriptions :: Adaware Guide :: HijackThis
Reply With Quote
  #5  
Old July 21st, 2004, 08:08 PM
Steven.Bentley Steven.Bentley is offline
CTH Subscriber
 
Join Date: Nov 2000
Location: West Yorkshire, UK
Age: 29
Posts: 3,840
I've never specified relationships explicitly in MySQL/PHPMyAdmin, I do that when I come to query the database by making sure that the two are equal in the where clause.

So for a db with a table called people with primary key id and a table answers where people.id is a foreign key I might do

select p.firstname, p.lastname, a.q1answer from people p, answers a where p.id=a.id;
__________________
Don't forget to post back with the results
Reply With Quote
Reply

Bookmarks

Topic Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:19 AM.

[ RSS ]