/*connection file*/
function connect(){
$server = "localhost";
$user = "xxxx";
$password = "xxxx";
$db = "xxxx";
$connetion = mysqli_connect($server,$user,$password,$db);
}
This is my connection file. i am connect to database using MVC.
/*function declaration and insert query*/
function insert($table,$value){
$fld = "";
$val = "";
$i = 0;
foreach ($value as $k => $v) {
if($i == 0){
$fld .= $k;
$val .= "'" . $v ."'";
}
else{
$fld .= "," . $k;
$val .= ",'" .$v . "'";
}
$i++;
}
global $conn;
return mysqli_query($conn,"INSERT INTO $table($fld) VALUES($val)") or die(mysqli_error($conn));
}
It is gives warning when i am trying to insert data into database.
Please help me for solve this warning.