Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- JavaScript ---
- function getXMLHttp() {
- var xmlHttp;
- try {
- xmlHttp = new XMLHttpRequest();
- } catch (e) {
- try {
- xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- return false;
- }
- }
- }
- return xmlHttp;
- }
- function count() {
- var xmlHttp = getXMLHttp();
- xmlHttp.open("POST", "count.php", true);
- xmlHttp.send(null);
- }
- --- PHP (count.php) ---
- <?php
- $pdo = new PDO('mysql:host=MYHOST;dbname=MYDATABSE;', 'USERNAME', 'PASSWORD');
- $sql = "UPDATE table SET field = field + 1";
- $pdo->exec($sql);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement