Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = 'ADMIN';
- $pass = 'ADMIN';
- $db = "pym";
- $FDeviceType = $_POST["deviceType"];
- $Flocation = $_POST["location"];
- $Foptions = $_POST["options"];
- $link = mysqli_connect("localhost", $username, $pass);
- if (!$link) {
- die("Could not connect: " . mysqli_connect_error());
- }
- //echo "Connected successfully";
- $db_selected = mysqli_select_db($link, "pym");
- if (!$db_selected) {
- die ("Can't use pym : " . mysqli_connect_error());
- }
- //echo "<br />Selected successfully";
- $FDeviceType = mysqli_real_escape_string($link, $FDeviceType); //protects agienst SQL injection
- $Flocation = mysqli_real_escape_string($link,$Flocation); //protects agienst SQL injection
- $Foptions = mysqli_real_escape_string($link,$Foptions); //protects agienst SQL injection
- $sql = "INSERT INTO `device` (`DEV_ID`, `DEV_Type`, `DEV_location`, `DEV_optinos`) VALUES (NULL, '$FDeviceType', '$Flocation', '$Foptions')";
- if (mysqli_query($link, $sql)) {
- echo "<br>record added!";
- } else {
- echo "<br>something went wrong";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement