MySQL Help
Posted: Sat Aug 06, 2005 5:57 am
I got two tables, one named 'user' and the other 'reports'. In both tables there is a field called 'province'. I have a form where a user has to type in some information and it is inserted into the reports table.
Like I mentioned above, the 'reports' table has a 'province' field. I want to write a function where it queries the 'user' table and gets the user's province and when the user fills out the form and hits submit, the province of the user is the same province that he/she inserted (I don't want the user to write in a province, they're already assigned one).
For example, I havae user whos username is demo, demo's province is Madrid, when demo logs into the system and fills out the form and hits submit; in the 'reports' table there is a 'province' field, this should be Madrid (It's automatic). Now let's say we have demo2, demo2's province is Andalucia, when demo2 fills out the form and hits submit, Andalucia should be added to the new row in the 'informes' table under the 'province' field.
Like I mentioned above, the 'reports' table has a 'province' field. I want to write a function where it queries the 'user' table and gets the user's province and when the user fills out the form and hits submit, the province of the user is the same province that he/she inserted (I don't want the user to write in a province, they're already assigned one).
For example, I havae user whos username is demo, demo's province is Madrid, when demo logs into the system and fills out the form and hits submit; in the 'reports' table there is a 'province' field, this should be Madrid (It's automatic). Now let's say we have demo2, demo2's province is Andalucia, when demo2 fills out the form and hits submit, Andalucia should be added to the new row in the 'informes' table under the 'province' field.