Hello guys. So the next question is of interest. There is a product table. There are standard fields, name, price, description. There is also a partner table where information about who entered information about the product is entered. There are two fields. Partner and product_id.

So, I wrote a web interface for customers, they add a product, the product is added, but it is necessary that information be added to the partner table, or rather the product id. The product table has a standard id field. Initially, this field is unknown, after adding it is known. I use the mysql_insert_id () function and get the last id added and insert the partner into the table. How much do I do right? or at all in the wrong direction digging.

    1 answer 1

    on the contrary, you need to do everything to add the partner's id to the product in order to display the goods loaded by this or another partner using this field.

    • I just do not want to make a lot of fields in one table, otherwise 15 fields have already turned out (((( - duddeniska
    • @Eugene Smiths, I'm sorry, but what's the difference? - andreyqin
    • you need to enter into the table exactly as much data as you need, you do not need to be afraid of the quantity .. the main thing is to index the fields being searched - deivan_
    • understandably! thank! everybody! - duddeniska
    • @andreyqin in fact is a “many to one” connection, and its implementation on the “one” side will lead to the fact that instead of one record there will be a zoo. While there are two columns in the table, the partner is represented by one line and is required only to display information about the product - that’s okay, but it’s better to do it all at once. - etki