Forums

PHP

This topic is locked

PHP MySQL Tables

Posted 02 Mar 2007 05:20:37
1
has voted
02 Mar 2007 05:20:37 Aaron Page posted:
I need some major help. I took on a project that is now over my head, but some information may help. For reference I am usnig Dreamweaver 8.

Questions:

1. I want to be able to have a few coloumns from a few different MySQL tables automaticlly copy themselves into a new MySQL table. How do I do this?

2. How can I make sure the data maintains its relashionships? example. One table contains users names, another users orders. I know access lets you draw diagrams, but I can't find anything of the sort for MySQL.

3. If I can't do "question 1" then how do I display multiple recordsets in one html table. I've tried using both dynamic table and repeating region, but neither one will work properly when trying to display data from two recordsets at the same time in the same table.

I hope I haven't asked too much, so I will stop there. Thank you in advance.

Replies

Replied 02 Mar 2007 12:30:41
02 Mar 2007 12:30:41 Roddy Dairion replied:
Ok first of all calm down.

Answers :
Question 1.
By doing an inner join with another table that has a relationship for example customer_table and order_table. Customer table must have a unique id lets call it customer_id. Order id should contain the id from the customer table i.e. customer_id. So like that you can link both table and display the field from both tables e.g. <pre id=code><font face=courier size=2 id=code>select customer_table.name, customer_table.telephone_no, order_table.product from customer_table INNER JOIN order_table on customer_table.customer_id = order_table.customer_id</font id=code></pre id=code>.
This will display all the customer name, telephone No and products that has an order only.
Question 2.
I think question 1 answers to this question as well.

Question 3.
Try question 1 and we'll see.

Reply to this topic