UPDATE and INSERT differences in syntax is an inconvenience

Posted by theband on Stack Overflow See other posts from Stack Overflow or by theband
Published on 2010-05-08T17:47:25Z Indexed on 2010/05/08 17:58 UTC
Read the original article Hit count: 264

Filed under:

I was going through this article today.

http://vinothbabu.com/2010/05/08/update-and-insert-differences-in-syntax-is-an-inconvenience/

I was not able to understand this part of the code written by the author.

    list($sets,$cols,$values)=escape_arr($sets);

    $insert_sql=”INSERT INTO `avatars` “.implode(’,',$cols).” 
    VALUES(”.implode(’,',$values).”)”;

    $update_sql=”UPDATE `avatars` SET “.implode(’,',$sets).”
    WHERE userid=$userid LIMIT 1?;

and finally the conclusion part of the article.

© Stack Overflow or respective owner

Related posts about php