i have users_skills and there are Id as primary key , U_Id which is foreign key to user table on Id , S_Id foreign key to skill table on Id i need to insert to that table an array of skills and the user Id and here,s my php code
<?php
include('database.php');
session_start();
if(isset($_POST['AddSkills']))
{
$uid=$_SESSION['id'];
$selected= $_POST['skill'];
foreach ($selected as $s)
{
$sql = "INSERT INTO users_skills (U_Id,S_Id) "
. "VALUES ('$uid','$s')";
}
if ( $mysqli->query($sql) ){
header("location:gallery.php");
}
else {
header("location: r.php");
}
}
?>
Aucun commentaire:
Enregistrer un commentaire