Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    inserting data into multiple tables through php?

    i have 5 tables in a single html form and i want to insert data into all of them when i click the submit button. how can i do this in php? iam a beginner and i have done insertion for a single table but dont know how to implement this? help me out

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,860
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    how can i do this in php? i
    Run 5 seperate queries for each table.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    I would also look into how you setup your database. Do you really need 5 tables for one form?




    ---------------
    Leonard Whistler

  • #4
    New Coder
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah in the html form wat iam doing is that by filling all the fields i m sending data to 5 differnt tables in the database. tables are product,category,metatag,productdiscount and relatedproduct. how can it be done?

  • #5
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by Mr.47 View Post
    product,category,metatag,productdiscount and relatedproduct. how can it be done?
    I don't know what info metatag has, and I'm not sure about related_product but the other 3 should be able to go in one table.

    Table 1
    Code:
    product_id | product_name | product_category | product_discount
    001 | Canon 5d | DSLR | 10
    002 | Canon 7d  DSLR | 5
    003 | 200mm | Lens | 5
    004 | 300mm | Lens | 20

    -----------------
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •