Advertisement
Guest User

Untitled

a guest
May 25th, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $fname = $_REQUEST['fname'];
  2. $fname1 = $_REQUEST['fname1'];
  3. $fname2 = $ip=$_SERVER['REMOTE_ADDR'];
  4. $fname3 = $_GET['id'];
  5. $fname4 = date('Y/m/d H:i:s');
  6. try {
  7. $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  8. // set the PDO error mode to exception
  9. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10. $sql = "INSERT INTO db (usern, passwd, ip, id, date)
  11. VALUES ('$fname', '$fname1', '$fname2', '$fname3', '$fname4')";
  12. // use exec() because no results are returned
  13. $conn->exec($sql);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement