lundi 21 août 2017

Not connecting to database anyway?? I was inserting data on compile time with almost same code by commenting $_GET portion [duplicate]

This question already has an answer here:

Not connecting to database anyway??
I was inserting data on compile time with almost same code by commenting $_GET portion..

No errors are showing on netbeans IDE? my db image http://ift.tt/2whXkWF

Can it be a MySQL configuration problem in my computer?

$server = '127.0.0.1';
$userid = 'root';
$pass = '';
$db = 'test';

$con = mysqli_connect($server, $userid, $pass, $db) or die(mysqli_error($con));
if(isset($_GET['submit']))
{
    $username= $_GET['uid'];
    $password= $_GET['pass'];

        $sql="insert into users values ($username,$password)";
        mysqli_query($con, $sql);

}

?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Register</title>
    </head>
    <body>
        <form method="get" action="index.php" >
            <table>
                <tr>
                    <td>UserName : </td>
                    <td><input type="text" placeholder="Choose a unique username" name="uid"></td>
                </tr>
                <tr>
                    <td>Password :</td>
                    <td><input type="password" placeholder="Choose a suitable password" name="pass"></td>
                </tr>

                <tr>
                    <td><button type="submit" value="submit" name="submit">Register</button></td>
                </tr>
            </table>

        </form>

    </body>
</html>

enter image description here




Aucun commentaire:

Enregistrer un commentaire