php - Uploading failed, please try agin -


this question has answer here:

when click on "add country", localhost says : uploading failed, please try again. can tell me mistake please ?

<?php      $db = new mysqli('localhost', 'root', '', 'db');      if(isset($_post["submit"]))     {         $c_code = addslashes($_post["c_code"]);         $c_name = addslashes($_post["c_name"]);         $c_key = addslashes($_post["c_key"]);         {           $sql = "insert countries(country_code, country_name, country_key) values('$c_code', '$c_name', '$c_key')";            $rs = mysqli_query($db, $sql);            if($rs)           {             echo "<script> alert('country uploaded successfully') </script>";           }            else            {             echo "<script> alert('uploading failed, please try again.') </script>";           }          }     }   ?> 

<?php  $db = new mysqli('localhost', 'root', '', 'db');  if(isset($_post["submit"])) {     $c_code = addslashes($_post["c_code"]);     $c_name = addslashes($_post["c_name"]);     $c_key = addslashes($_post["c_key"]);     //remove this:"{"         $sql = "insert countries(country_code, country_name, country_key) values('$c_code', '$c_name', '$c_key')";        $rs = mysqli_query($db, $sql);        if($rs)       {         echo "<script> alert('country uploaded successfully') </script>";       }        else        {         echo ("error here:" .mysqli_error($db));       }      }   //also remove this: "}" 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -