Data insert Error in Wamp 3.0.6 mysql 5.7.14
Posted by: pateldh (210.212.67.---)
Date: July 15, 2017 06:10AM

Hi, I am getting error in Data insert. following is th code.

Database name is : stores

table name: emp_registration

Fields are :
id (Primary Key & Auto increment), firstname(varchar),
middlename(varchar),
lastname(varchar),
username(varchar),
password(varchar),
email(varchar),
contact(varchar),
sem(varchar),
enrollmentno(varchar),
status(varchar)

<?php
	include "connection.php";
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Employee Registration Form | SMS </title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/custom.min.css" rel="stylesheet">
</head>
<br>
<div class="col-lg-12 text-center ">
    <h1 style="font-family:Lucida Console">Stores Management System</h1>
</div>
<body class="login" style="margin-top: -20px;">
    <div class="login_wrapper">

            <section class="login_content" style="margin-top: -40px;">
                	<form  name="form1" method="post" action="">
                    <h2>User Registration Form</h2><br>
                    <div>
                        <input type="text" class="form-control" placeholder="FirstName" name="firstname" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="MiddleName" name="middlename" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="LastName" name="lastname" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="Username" name="username" required/>
                    </div>
                    <div>
                        <input type="password" class="form-control" placeholder="Password" name="password" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="email" name="email" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="contact" name="contact" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="SEM" name="sem" required/>
                    </div>
                    <div>
                        <input type="text" class="form-control" placeholder="Enrollment No" name="enrollmentno" required/>
                    </div>
                    <div class="col-lg-12  col-lg-push-3">
                        <input class="btn btn-default submit" type="submit" name="submit1" value="Register">
                    </div>
                </form>
            </section>

<?php
if(isset($_POST['submit1']))
{
    $qry=mysqli_query($link,"insert into  emp_registration
                             values('','$_POST[firstname]','$_POST[middlename]','$_POST[lastname]',
                                         '$_POST[username]','$_POST[password]','$_POST',
                                         '$_POST[contact]','$_POST[sem]','$_POST[enrollmentno]','No')&quot;
                                   );
?&gt;
        &lt;div class=&quot;alert alert-success col-lg-12 col-lg-push-0&quot;&gt;
        Registration successfully, You will get email when your account is approved
        &lt;/div&gt;
    &lt;?php
       
	    	}
	?&gt;
  &lt;/div&gt;  
&lt;/body&gt;
&lt;/html&gt;


After filling all fields data cannot insert but registration sucessfully msg comes. please help me what anything going wrong.
my Whatsapp no : +91 9327823000
: +91 9727731765

Please suggest or contact on above number



Edited 3 time(s). Last edit at 07/15/2017 04:04PM by RiggsFolly.

Options: ReplyQuote
Re: Data insert Error in Wamp 3.0.6 mysql 5.7.14
Posted by: RiggsFolly (Moderator)
Date: July 15, 2017 04:13PM

Hi

This is not the site for getting assistance with fixing PHP code. However I have a few suggestions that might help you

1.
Your script is at risk of SQL Injection Attack Even
if you are escaping inputs, its not safe!
Use prepared parameterized statements

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote


Sorry, only registered users may post in this forum.