I have been learning phpmyadmin, this is my current learning/test environment below.
I created my first database today I refer to as db1 it is simple structure with only three input fields.

And one primary id in phpmyadmin.
And one unique structure field for username. and also i have added timestamp variable

Any further recommendations apart from adding POD would be appreciative.


            <title>db1 test</title>
            <form id="myForm" action="userInfo.php" method="post">
              Username: <input type="text" name="username" /><br />
              Name: <input type="text" name="name" /><br />
              Favourite Number: <input type="text" name="favouritenumber" `

   /><br />`
              <button id="sub">Save</button>

            <span id="result"></span>

            <script src="/script/jquery-1.8.1.min.js" type="text/javascript"></script>
            <script src="/script/my_script.js" type="text/javascript"></script>



$host = "localhost";
$port = "8889";
$servername = "$host";
$username = "forest";
$password = "";
$db = "db1";

// Create connection
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);


include_once "includes/db1.php";    
$username = $_POST['username'];
$name = $_POST['name'];
$favouritenumber = $_POST['favouritenumber'];
if(mysqli_query($conn,"INSERT INTO user(username,name,favouritenumber) VALUES ('$username', '$name', '$favouritenumber');"))
    echo "Successfully Inserted";
    //echo "<a href='login_success.php'>Back to main page</a>";

else {
    echo "ERROR not entered";
// close connection

closed as off-topic by Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ Feb 11 at 18:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Ludisposed, 200_success, Toby Speight, Graipher, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ hello this code is working thankyou anyway \$\endgroup\$ – zip Feb 12 at 1:38
  • \$\begingroup\$ updated from db.php to db1.php for you @Sᴀᴍ Onᴇᴌᴀ \$\endgroup\$ – zip Feb 12 at 3:46
  • \$\begingroup\$ this is all you need to know about improved mysqli: connection, and runing a query \$\endgroup\$ – Your Common Sense Feb 12 at 6:41

Browse other questions tagged or ask your own question.