Search Results

Search found 1 results on 1 pages for 'user573382'.

Page 1/1 | 1 

  • Auto-creating a "link" table between 2 main tables (ex table EmployeeProject from Employee and Project tables)

    - by user573382
    Hello! I have these 2 tables, Medication containing: IDMedication, IDCategory, Name, and Supplier, containing: IDSupplier, Name. I want to automatically create a relationship table, MedicationSupplier, containing: IDMedication and IDSupplier as keys, Price, and Quantity. My idea was to have a main page where i request the following data: (Medication)Name, IDCAtegory, (Supplier)Name, Price, Quantity. I'm not sure if i'm doing the right thing here. So this is what i'm receiveing in the .php where i do the insert: $Denumire=$_POST['Denumire']; //Medication Name $IDCategorie=$_POST['IDCategorie']; //IDCategory $Nume=$_POST['Nume']; //Supplier Name $Pret=$_POST['Pret']; //Price $Stoc=$_POST['Stoc']; //Quantity And this is my insert: $q_produse = "INSERT INTO produse VALUES ('','$IDCategorie','$Denumire')"; $q_prodfurniz = "INSERT INTO produsfurnizor VALUES ('','$IDFurnizor','$Pret','$Stoc')"; mysql_query($q_produse) or die($error); mysql_query($q_prodfurniz) or die($error); mysql_close(); My main problem at the moment is that i don't know how to insert IDMedication in the relationship table. Any help / suggestions of improving my code would be greatly appreciated. Thanks!

    Read the article

1