lundi 18 juillet 2016

Storing 2D array in MySQL Database

I'm trying to build a project for which I need to store data to the MySQL Database. For each activity, I can have several resources. Like for Activity One, I can have Resource1, Resource2, Resource3, etc.

How do I store these resources in one single column in the database?

foreach($_POST['name'] as $key=>$value){
        //what do I insert?
        mysqli_query($conn,"INSERT INTO activity
            (`serial`,`Name`) VALUES(null,'$value')");
    }

Right now, I'm just able to save the names of activities.

Aucun commentaire:

Enregistrer un commentaire