adding to two tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nutstretch
Forum Contributor
Posts: 104
Joined: Sun Jan 11, 2004 11:46 am
Location: Leicester

adding to two tables

Post by nutstretch »

I have a database which has a customer table and a booking table. When a new customer registers, an insert query is sent which adds them to the customer database. I then need thier CustNo to put into the booking table. CustNo is an autonumber form the customer table.

I tried doing a selct where the email address is the same as the email address just added ( held in $email) and then I want to do anther insert into the other table.

This is not working for the second database and I don't seem t be retrieving anything from the customer table when using the select.

Does the table need refreshing or anything before I try and retrieve the record I just added?

any help appreciated

Angie
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

use mysql_insert_id() to get the last inserted id and add to the booking table...
Post Reply