php - How To Generate An SQL Insert Query From A List Of Values? -


i have long list of values , want insert them database using sql query, writing statement taking long. there way in php, give me ready use insert query list of values provided?

i hereby providing (incomplete)sql query :

insert `aichiwj2_reesk`.`me_skills`  (`id`, `skill_name`, `skill_type`, `timestamp`)  values  (null, 'able listen', 'it', current_timestamp),  (null, 'accept feedback', 'it', current_timestamp);` 

.....and continues....

hereby providing list of values (i using <li> view values 1 after other or else, viewing together):

  • able listen
  • accept feedback
  • adaptable
  • artistic sense
  • assertive
  • attentive
  • business storytelling
  • business trend awareness
  • collaborating
  • communication
  • competitive
  • confidant
  • conflict resolution
  • cooperative
  • courteous
  • crisis management
  • critical observer
  • critical thinker
  • customer service
  • deal making
  • deal difficult situations
  • deal office politics
  • deals difficult people
  • decision making
  • dedicated
  • delegation
  • dependable
  • design sense
  • desire learn
  • disability awareness
  • dispute resolution
  • diversity awareness
  • place list of skills inside array, iterate on array , echo sql string browser. it's not fancy, job done.

    i rusty in php, i'll not able paste full solution. may work, haven't been able test since don't have machine php right now.

    $array = ("skill1", "skill2", "skill3"); $queries_string = "insert `aichiwj2_reesk`.`me_skills` (`id`, `skill_name`, `skill_type`, `timestamp`) values "; ($i = 0; $i < len($array); $i++)     $queries_string .= "(null, '"+$array[$i]+"', 'it', current_timestamp), "; echo $queries_string 

    after prints on screen should replace sinal space , comma ;

    sorry can't anymore right now.


    Comments

    Popular posts from this blog

    c++ - No viable overloaded operator for references a map -

    java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

    java - Cannot secure connection using TLS -