Guest User

Untitled

a guest
Jun 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. // Database connection stuff here
  4. $link = mysql_connect('localhost', 'root', 'dancehall');
  5. if (!$link) {
  6. die('Not connected : ' . mysql_error());
  7. }
  8. $db_selected = mysql_select_db('counter', $link);
  9. if (!$db_selected) {
  10. die ('Can\'t use foo : ' . mysql_error());
  11. }
  12.  
  13. $x ="SELECT * from counter where id='$id'";
  14. $result = mysql_query($x) or die
  15. ("Could not execute query : $x." . mysql_error());
  16.  
  17. while ($row = mysql_fetch_array($result))
  18. {
  19. $id = $row["id"];
  20. $FileName = $row["FileName"];
  21. $FileURL = $row["FileURL"];
  22. $Count = $row["Count"];
  23.  
  24. header('Location: '.$FileURL);
  25.  
  26. $x ="update counter set Count=Count+1 where id='$id'";
  27. $result = mysql_query($x) or die
  28. ("Could not execute query : $x." . mysql_error());
  29.  
  30. }
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment