0

Halo Developers.

Please help me get my HTML data to the database.

It's connecting and echoing the values correctly, but when I check the database, empty!

Here's the code:

<?php

include "conn.php";

    $nyamaV = $_POST['nyamaH']. "<br />";
    $mbogaV = $_POST['mbogaH'];
    $ugaliV = $_POST['ugaliH'];
    $mturaV = $_POST['mturaH'];
    $pizzaV = $_POST['pizzaH'];
    $matumboV = $_POST['matumboH'];
    $omenaV = $_POST['omenaH'];
    $nyanyaV = $_POST['nyanyaH'];
    $kitunguV = $_POST['kitunguH'];
    $daniaV = $_POST['daniaH'];
    $hohoV = $_POST['hohoH'];


$ingizaV = "INSERT INTO scripture (nyamaT, mbogaT, ugaliT, mturaT, pizzaT, matumboT, omenaT, nyanyaT, kitunguT, daniaT, hohoT)
VALUES ('$nyamaV', '$mbogaV', '$ugaliV', '$mturaV', '$pizzaV', '$matumboV', '$omenaV', '$nyanyaV', '$kitunguV', '$daniaV', '$hohoV')";

echo $nyamaV;
echo $mbogaV;
echo $ugaliV;
echo $mturaV;
echo $pizzaV;
echo $matumboV;
echo $omenaV;
echo $nyanyaV;
echo $kitunguV;
echo $daniaV;
echo $hohoV;

?>
bassxzero
  • 4,838
  • 22
  • 34

2 Answers2

-1

The data will not be saved to the database until you are not executing the query with the help of mysqli_query() method.

For example,

$sql_query = "INSERT INTO users(firstname,lastname) VALUES('Lee','Jhonson')";
//$conn = connection parameters that are already defined in your conn.php file
$executed_query = mysqli_query($conn,$sql_query );
Nilesh Sanyal
  • 836
  • 6
  • 10
-1
mysqli_query(connection,query);

put mysqli connect in connection & put insert query in query

mysqli_query($connection,$ingizaV);
//$connection = connection parameters that are already defined in your conn.php file
Prashant
  • 143
  • 1
  • 1
  • 7