1

私はしばらくの間、phpMyAdmin挿入と戦ってきました。エラーは発生しませんが、データベースに挿入されません。

私のコードは次のようになります

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="43%" id="AutoNumber1">
  <tr>
    <td width="100%">
    <p align="left">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
    <form method="GET" name="testform" id="testform" action="logout.php">
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="69%" id="AutoNumber2" height="63">
        <tr>
          <td width="36%" height="22">Username</td>
          <td width="64%" height="22"><input type="text" name="user" size="20"></td>
        </tr>
        <tr>
          <td width="36%" height="22">password</td>
          <td width="64%" height="22">
          <input type="password" name="passwd" size="20"></td>
        </tr>
        <tr>
          <td width="36%" height="19">&nbsp;</td>
          <td width="64%" height="19">
          <input type="submit" value="login" name="login"></td>
        </tr>
      </table>
    </form>
    </td>
  </tr>
</table>

</body>

</html>

今、phpもこのようになります

<?php

require_once('inc/config.php');
$user = $_GET['user'];
$pass = $_GET['passwd'];

//database connection
$conn = mysqli_connect(DBHOST,DBUSER,DBPASS,DB);

//mysql anti injection    
$username = mysql_real_escape_string($_GET['user']);
$password = mysql_real_escape_string($_GET['passwd']);

$sql = "INSERT INTO people (`username`, `password`) VALUES ('$username', '$password');";
mysqli_close($conn);

echo "Inserted";

?>

問題は、ローカル ホストで表示したときに、mysql データベースに挿入したものが表示されないことです。何が問題ですか?

4

1 に答える 1