1

I have been battling with phpMyAdmin insert for sometime now, It doesn't give me an error, yet it won't insert into the database.

My code goes like this

<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>

Now the php also goes like this

<?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";

?>

Trouble is, I don't see what I insert into the mysql database, when viewed on local host; what is the problem?

1 Answers1

-2

Seems like the issue might be the use of ';' twice at the end of the following line:

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

Try the following.

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