PHP/MySQL Insert Looping using a Single String of text of names seperated by Commas

software development

#1

I need a php function that will take an undertermined very long list of names as a single text string that are seperated by commas, e.g. “john,mary,ken,mark,…”

loop through and insert each of the names as a new table row. When all the names have been inserted the loop ends.

I am familiar with c/c++ but new to php. Any assistance to the best way to do this much appreciated.


#2

Ingredients:
insert: http://www.tizag.com/mysqlTutorial/mysqlinsert.php
explode: http://php.net/manual/en/function.explode.php
foreach: http://www.php.net/manual/en/control-structures.foreach.php

Mix and season to taste.


#3

Thank-you.