#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    3
    Rep Power
    0
    I use
    insert into orders (customer_id,customer_firstname, customer_surname) select customer_id,customer_firstname,customer_surname from customers where customer_id= '$sesuser'

    It's work but, i need insert also another values into oredr database.
    Do know somebody how can i do it, in one insert statement ?

    [This message has been edited by Vladimir VICIAN (edited November 17, 2000).]
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,645
    Rep Power
    4492
    What other values do you need to insert? Can you do a join on another database to get them in all one select? Explain your database structure and what data you're trying to get where...

    ---John Holmes...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    3
    Rep Power
    0
    I need insert some external values from PHP, not from tables.
    I need insert also payement_method into orders table form $HTTP_GET_VARS['p_method']

    Vladimir VICIAN, Slovakia

    [This message has been edited by Vladimir VICIAN (edited November 17, 2000).]
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    When using an insert ... select... you can only insert values obtained in the select.. however, you can select whatever you want.

    ie.

    insert into orders (customer_id,customer_firstname, customer_surname,some_other_field) select customer_id,customer_firstname,customer_surname,'The value to insert in some_other_field' from customers where customer_id= '$sesuser'

    You will have to use a seperate insert for the other table, though.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    3
    Rep Power
    0
    Thank you ROD K,

    This

    insert into orders (customer_id,customer_firstname, customer_surname,some_other_field) select customer_id,customer_firstname,customer_surname,'The value to insert in some_other_field' from customers where customer_id= '$sesuser'

    WORKS FOR ME, THANK YOU

Similar Threads

  1. how to insert data from html select
    By tabashishi in forum MySQL Help
    Replies: 2
    Last Post: February 11th, 2004, 12:29 PM
  2. insert a select and custom values
    By naiad in forum MySQL Help
    Replies: 2
    Last Post: February 8th, 2004, 04:28 PM
  3. Nested insert help
    By mrras25 in forum MySQL Help
    Replies: 2
    Last Post: February 4th, 2004, 04:00 PM
  4. Zip code validation
    By krwyth in forum MySQL Help
    Replies: 2
    Last Post: January 5th, 2004, 01:29 PM
  5. Syntax error in INSERT INTO query
    By Lee Miles in forum Visual Basic Programming
    Replies: 6
    Last Post: December 19th, 2003, 07:37 AM

IMN logo majestic logo threadwatch logo seochat tools logo