0

Hi everyone I'd like to insert my values from $_POST array to my database.

I was looking for some links of this issue, however I haven't found anything.

This is what I'm trying to, I don't know if has some logical or not.

PHP code


function addData($Connect, $value)
{
  $query = "INSERT INTO Customers VALUES($value)";
  mysqli_query($Connect, $query);
}

$Connect = connectDB();

if($Connect == true)
{
  foreach($_POST as $key => $value)
  {
    addData($Connect, $value);
  }
}

mysqli_close($Connect);

Is there any easy way to do this?, because now this code isn't working.

Thanks to everyone!

javi-ur96
  • 55
  • 6

0 Answers0