I need a php code that logs the current site's a URL (with all arguments eg:http://example.com/?=kagfdfaloajlflzw!) in an sqldatabase. Please tell me whole thing (inclding the creation of the sql database, i'm a noob webmaster!). When the page loads, this script will log the address into an sql database, to track its reference or categories. Please do help me, all help appreciated!
I already have a scipt, but it doesn't work(for some reason) and its as follows:
<html headers>
<?php
$url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
mysql_connect("example.x10hosting.com", "databasename", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['$url2']."', '".$_POST["http://" . $domain . $_SERVER['REQUEST_URI']]."')";
$add_member = mysql_query($insert);
?>
<html codes>
And its a .html page
I already have a scipt, but it doesn't work(for some reason) and its as follows:
<html headers>
<?php
$url2 = "http://" . $domain . $_SERVER['REQUEST_URI'];
mysql_connect("example.x10hosting.com", "databasename", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['$url2']."', '".$_POST["http://" . $domain . $_SERVER['REQUEST_URI']]."')";
$add_member = mysql_query($insert);
?>
<html codes>
And its a .html page
Last edited: