• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Need to add child row in mySql through php

Question

dydx123    44

Okay so it;s a bit weird but I was hoping maybe you guys. So, it goes something like this: I've a mySQL table with 4 columns i.e address, phone, email and name. Now I created another table where I would store their order names and prices. But how do I link the two? I mean I can create a front end where I can add customer to the customer table but when I try to add the order through the frontend I don't know how to link the order with the correct customers in the customer table? I know how to link the orders with their respective customer in the database but how do I achieve the same through frontend?

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
exotoxic    672

If i understand what your trying to do, you need a CustomerId field on both tables (with a foreign key constraint).

insert into customers_tbl (...)

                    values (...)

                    where CustomerId = :CustomerId

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.