Halo Developers。
请帮我把我的HTML数据存入数据库。
它正确连接和回显值,但是当我检查数据库时,空了!
以下是代码:
<?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;
?>
答案 0 :(得分:-1)
在您不使用mysqli_query()方法执行查询之前,数据不会保存到数据库中。
例如,
$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 );
答案 1 :(得分:-1)
mysqli_query(connection,query);
把mysqli连接到连接&amp;将查询插入查询
mysqli_query($connection,$ingizaV);
//$connection = connection parameters that are already defined in your conn.php file