This topic is locked

Dependant lists

1/16/2007 7:09:05 PM
PHPRunner General questions
T
thesofa author

Hi, probably a very simple answer to this, I am doing a database for recording and ordering printer supplies, inks, cartridges, drums and various kits.

I will use version 3.0 for this unless it can only be done with version 3.1111111

To make life eassier for the users, I would like them to pick the maker, HP, Brother, IBM etc.

This will then act as a filter for the model number field.

This will then act as a filter for the actual spares and supplies we need for that printer.

Tables are

Make

Model

Items

So I can setup a structure for the drop down select boxes which allows user to pick make, then model, then the bits they want to order.

That is fine

However, all I want to record in the record I save is the code for the item purchased, along with the number ordered and the current price.

I know how to set the lookup field to a field from the relevat tables, how do I put a dummy field in the sql statement to allow me to use the lookups from the tables, but only record the item code?

I know I am probably staring it in the face, but I am stuck on this one.

Please help

Cheers

J
Jane 1/17/2007

I'm afraid there is no easy way to do it.

T
thesofa author 1/17/2007

I have read posts where the user wants to show a total on the page, so an extra "fake" field is added to the sql query along the lines of

`number_in_stock`-`number_sold` AS Balance,

and Balance is used in the forms and pages, can I not do something similar here for the dependant lookup?

J
jim9 1/28/2007

Make another table, and have an id column same as your other table and of course this table will have it's own autoincrement column. Add the field(s) for purchases you want. Then use a custom event to add your code and perhaps a purchase date or whatever you need to add. Can be tricky, but it's doable. See the php manual for last inserted id, I forget exactly what it is called but some like that. Think of it as an order invoice program. You have a master for orders, and child table for the individual purchases that fall under this order.

T
thesofa author 1/29/2007

Make another table, and have an id column same as your other table and of course this table will have it's own autoincrement column. Add the field(s) for purchases you want. Then use a custom event to add your code and perhaps a purchase date or whatever you need to add. Can be tricky, but it's doable. See the php manual for last inserted id, I forget exactly what it is called but some like that. Think of it as an order invoice program. You have a master for orders, and child table for the individual purchases that fall under this order.



Thanks Jim, the problem with that is there is multiple acccess to these tables from 50 staff at the same time, all the activity is in short bursts at the end of each lesson so there may be problems with that method.

However, I shall continue digging and keep you informed of progress.

Many thanks for your help

Cheers