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
Post a Comment