Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Thanked 1 Time in 1 Post

    SQL duplicate row with PHP

    I want to make another data of row but the data that i need to add is quite equal to another row

    So what can i do to duplicate this row?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 Posts
    If you are referring to a primitive variable data such as an array of primitives, you can simply extract what you want and append, nothing needs to change since they are not references.
    If the data is an object, you call a clone $obj to clone it.
    If the data is SQL, you can query it, and insert it, or use a SELECT INTO/INSERT SELECT command depending on your database. If its a database that has replicated data aside from the primary key, this is an indication of an un-normalized database and the design itself should be reviewed and changed before further steps are done.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    sorlaker (11-26-2010)


    Posting Permissions

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