1

我正在尝试使用 HTTP_Referrer(它们的来源)、日期和递增的流量 URL 创建自定义 URL

mysql_connect('localhost', 'mysql_user', 'mysql_password');

mysql_select_db('database');

mysql_query("INSERT INTO table (TrafficID, ClickURL, CreateDate) VALUES('".mysql_real_escape_string($_GET['TrafficID'])."',  '".mysql_real_escape_string($_GET['ClickURL'])."', '".mysql_real_escape_string($_GET['CreateDate'])."')");
mysql_query("UPDATE table_name SET out = out + 1 WHERE ID = $TrafficID")or     die(mysql_error());
$data = mysql_query("SELECT * FROM table_name WHERE ID = $TrafficID") or     die(mysql_error()); 
$info = mysql_fetch_array($data); 
$variable['TrafficID'] = "id"; 
$variable['ClickURL'] = "url";
$variable['CreateDate'] = "date"; 
$value['TrafficID'] = "mysql_fetch_array($data);"; 
$value['ClickURL'] = "$_SERVER['HTTP_REFERER']";
$variable['CreateDate'] = "$today"; 
$link = "http://www.example.com/page.php";
$link .= "?";
$link .= $variable['TrafficID'] . "=" . $value['TrafficID'];
$link .= "&";
$link .= $variable['ClickURL'] . "=" . $value['ClickURL'];
$link .= "@";
$link .= $variable['CreateDate'] . "=" . $value['CreateDate'];
echo "<a href='" . $link . "'>Click here!</a>";`

理想情况下,该 URL 看起来像http://www.example.com/page.php?TrafficID&ClickURL@date并且这将全部存储在数据库中,但是我似乎无法让它工作,任何人都可以指出我在哪里犯了个错误?

更新

$value['ClickURL'] = "$_SERVER['HTTP_REFERER']";
$today = date("Ymd");  
$variable['CreateDate'] = "$today"; 
$link = "http://www.example.com/page.php";
$link .= "?";
$link .= $variable['TrafficID'] . "=" . $value['TrafficID'];
$link .= "&";
$link .= $variable['ClickURL'] . "=" . $value['ClickURL'];
$link .= "&";
$link .= $variable['CreateDate'] . "=" . $value['CreateDate'];
echo "<a href='" . $link . "'>Click here!</a>";`

将 @ 更改为 & 并重新格式化我的日期值

4

0 回答 0