Error in Insert Data using Php and Mysql -


i have form file upload , user name exits checking conditions. im facing data not getting insert in mysql db. file been saved in given path. kindly me on im wasted 2days tried lot myself.

form.php

<table style="text-align:right">     <form id="add" method="post" action="action.php" enctype="multipart/form-data">         <tr>             <h4 class='bg-info'>                 <br/> &nbsp &nbsp &nbsp &nbsp become member of jobportal , find right job. create profile now, free!<br/><br/>             </h4>         </tr>         <tr>             <td></td>             <td> * mandatory fields  </td>         </tr>         <tr>             <div class="col-md-1"></div>             <td>enter email-id: *</td>             <td><input class="form-control input-sm" placeholder="email id" type="textfield" name="email"required></td>         </tr>         <tr>             <td>choose password *</td>             <td><input class="form-control input-sm" placeholder="enter password" type="password" name="password"required/></td>         </tr>             <td>re-enter password *</td>             <td><input class="form-control input-sm" placeholder="enter password" type="password" name="repassword"required/></td>         </tr>         <tr>             <td> please enter full name:</td>             <td> <input class="form-control input-sm" placeholder="enter full name" type="textfield" name="name"required></td>         </tr>         <tr>             <td>your current location: *<td>             <select class="form-control input-sm" required name="location">                 <option value='' disabled selected style='display:none;'>select location *</option>                 <option>andhra pradesh</option>                 <option>arunachal pradesh</option>                 <option>assam</option>                 <option>bihar</option>                 <option>chhattisgarh</option>                 <option>goa</option>                 <option>gujarat</option>                 <option>haryana</option>                 <option>himachal pradesh</option>                 <option>jammu , kashmir</option>                 <option>jharkhand</option>                 <option>karnataka</option>                 <option>kerala</option>                 <option>madhya pradesh</option>                 <option>maharashtra</option>                 <option>maharashtra</option>                 <option>manipur</option>                 <option>meghalaya</option>                 <option>mizoram</option>                 <option>nagaland</option>                 <option>odisha</option>                 <option>punjab</option>                 <option>rajasthan</option>                 <option>sikkim</option>                 <option>tamil nadu</option>                 <option>telangana</option>                 <option>tripura</option>                 <option>uttar pradesh</option>                 <option>uttarakhand</option>                 <option>west bengal</option>             </select></td>             </td>         </tr>         <tr>             <td>enter mobile number: *</td>             <td><input class="form-control input-sm" placeholder="mobile number" type="textfield" name="mobilenumber" required/></td>         </tr>         <tr>             <td>experience:</td>             <td>                 <select class="form-control input-sm" required name="experience">                     <option value='' disabled selected style='display:none;'>select experience</option>                     <option>fresher</option>                     <option>1</option>                     <option>2</option>                     <option>3</option>                     <option>4</option>                 </select>             </td>         </tr>         <tr>             <td>key skill: *</td>             <td>                 <input class="form-control input-sm" placeholder="enter skill" type="textfield" name="keyskill"/>             </td>         </tr>         <tr>             <td>please select pg degree</td>             <td>                 <select class="form-control input-sm" required name="degree">                     <option value='' disabled selected style='display:none;'>select degree</option>                     <option>b.sc</option>                     <option>b.e</option>                     <option>b.com</option>                     <option>others</option>                 </select>             </td>         </tr>         <tr>             <td>please select higher studies:</td>             <td>                 <select class="form-control input-sm" required name="hsc">                     <option value='' disabled selected style='display:none;'>select higher studies</option>                     <option>hsc</option>                     <option>diploma</option>                     <option>iti</option>                     <option>others</option>                 </select>             </td>         </tr>         <tr>             <td>please select gender: *</td>             <td>                 <select class="form-control input-sm" required name="gender">                     <option value='' disabled selected style='display:none;'>select</option>                     <option>male</option>                     <option>female</option>                     <option>others</option>                 </select>             </td>         </tr>         <tr>             <td>upload resume :</td>             <td><input type="file" name="filep"></td>         </tr>         <tr>             <td> </td>             <td>by clicking register u accepting our terms , condtions. click here !</td>         </tr>         <tr>             <td></td>             <td>                 <input type="submit" name="add" class="btn btn-info btn-sm" id="add" value="register jobportal">             </td>         </tr>     </form> </table> 

action.php

$con = mysqli_connect('localhost','root',''); if (!$con) {     die('could not connect: ' . mysql_error()); } else {     echo 'connected'; } if (isset($_post['add']) ) {     if (!get_magic_quotes_gpc() ) {         $email = addslashes ($_post['email']);     } else {         $email = $_post['email'];     }     $email = $_post['email'];     $password = md5 ($_post['password']);     $name = $_post['name'];     $location = $_post['location'];     $mobilenumber = $_post['mobilenumber'];     $experience = $_post['experience'];     $keyskill  = $_post['keyskill'];     $degree = $_post['degree'];     $hsc = $_post['hsc'];     $gender = $_post['gender'];     $resume = $_files['filep']['name'];     $folder = "c:/wamp/www/userlogin/pic/";     $name="select emailid userregistration emailid='$email'";     mysqli_select_db($con, 'login');     $result = mysqli_query($con, $name);     if (mysqli_num_rows($result)!=0) {        echo "username exists";     } else {         echo"data entered done";     }      if (move_uploaded_file($_files["filep"]["tmp_name"], $folder . $_files["filep"]["name"])) {         echo "images moved sus";     } else {         echo "not done";     }      echo "<p align=center>file ".$_files["filep"]["name"]."loaded...";      $sql = "insert userregistration "         . "(email, password, name, location, mobilenumber, experience, keyskill, degree, hsc, gender, resume)"         . "values('$email', '$password', '$name', '$location', '$mobilenumber', '$experience', '$keyskill',         '$degree', '$hsc', '$gender', '$resume')";     mysqli_select_db($con, 'login');     $retval = mysqli_query($con, $sql);     if (!$retval) {         die('could not enter data: ' . mysql_error());     }     echo "entered data successfully\n";     echo'<a href="index.php"> insert more data </a>';     mysqli_close($con); } 

what need is: want upload form data file url database , need check email id or name exits.

i error in $sql = "insert into" portion other else working fine.

thanks in advance.

echo sql query before mysqli_select_db($con, 'login'); , execute in mysql phpmyadmin...

i guess there problem in query formation, spacing between words or something.


Comments