<html>
<body>
<?php include './includes/connect_db.php' // connecting to mysql server ?>
<?php include './includes/select_db.php' // selecting database ?>
<?php
$username=$_POST["username"];
$password=$_POST["pass"];
$email=$_POST["email"];
$sql="insert into table 'users' values ('$username','$password','$email')";
if(mysql_query($sql,$connect))
{
echo "query executed";
}
else
{
echo "query did not run ".mysql_error();
} ?>
<?php include './includes/close_db.php' ; //closing connection ?>
该表由 4 个字段组成,(id、用户名、密码、电子邮件)。“id”是主键并自动递增。一切正常,除了查询和 php 没有显示查询中的错误,尽管 display_error 为 ON 是 .ini 文件。