Print all from Database table in PHP

Associate
Joined
6 Mar 2009
Posts
495
I have a search function which will allow users to search from different fields of each table in my database. For example "Date" and "Time". I would like then for the rest of the fields relating to the search to be printed out into a php table. I can do it by hard coding the fields i want printed out but each table has a different amount of table heading or fields so is there a way of printing all. Is there a way of using the '*' to print all the table heading and data from the search??

Thanks
 
I haven't any relationships between my tables. I have different tables for different products which are tested every so often and recorded into the database. Some products have a different amount of test in them, some may have 6, some may have 10. So if i search for a test that was taken yesterday i would like to print all the test values on that product.
 
Here is a brief design of how each table looks.

Code:
Product Table: Product 1
---------------------------------------------------------------------------
-Date | Start Time | Test1 | Test 2 | Test 3 | Test 5 | Test 6 | Pass/Fail

So i have one of those for every product and would like to print it out with basically the same layout in table form. I understand where your coming from in regards to setting up relationships etc. I sort of started into this head first without thinking it through.
 
I guys, sorry for the late reply.

Ed, yes at the minute each product has its own table.
I will try to sort my tables in some sort of normal form. Just find it hard to think of how it would work for my database. I am trying to create an electronic method which users will be able to input test results taken on each product when they are made. At the minute it is all done by paper form and would like to eliminate this.

May be able to have a table of all the products to be tested and at table for which part of the factory they are made in.

Will see how it goes.

Thanks guys
 
Ok i have come up with this so far below. Tell me if I am on the right tracks please.

Code:
products
--------------------------------------------------
product_id | product_name| circuit_id
-1         | ..........  | 1
-2	   | ..........  | 2
-3         | ..........  | 3

Circuit
---------------------------------------------------
circuit_id | circuit_name | 
-1         | ............           
-2         | ............
-3         | ............

Testing
-------------------------------------------------
testing_id | testing_name | product-id
-1         | ............ | 3
-2	   | ............ | 6
-3         | ............ | 1

Each product has its own id, each product has its own test and circuit is where the product is being made. Although for what i am doing I think it would be better for each product to have its own table its it test results in it.

Any advice or tips would be great:)
 
Each product has its own separate test but there are 8 different locations or (Circuits) where they are made.

So by doing the above how do i link testing_id to its own table?? Is it just whatever you called the table in the database you call the testing_name?? So once again i am going to have a table for each product!
 
Back
Top Bottom