简单的出站链接跟踪器-为什么不起作用? [英] simple outbound link tracker - Why isn't this working?
本文介绍了简单的出站链接跟踪器-为什么不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
/** Connect to DB */
mysql_connect("localhost", "dbuser", "pass") or die(mysql_error());
mysql_select_db("dbname") or die(mysql_error());
$link_id = $_GET['link_id'];
/** increase the counter of the URL*/
mysql_query("UPDATE link_count SET count = count + 1 WHERE ID = $link_id") or die(mysql_error());
/** retrieve URL */
$result = mysql_query("SELECT * FROM link_count WHERE ID = $link_id") or die(mysql_error());
$row = mysql_fetch_array($result);
header( "Location:" .$row['URL'] );
?>
当然,数据库信息已更改为可在此处发布.我尝试使用
Of course db info has been changed for posting here. Where I try to use
count.php?link_id=1
在链接中,我得到'where子句'中的未知列'ID'"
in a link I get "Unknown column 'ID' in 'where clause'"
我检查以确保所有单引号而不是反引号....
I checked to make sure there were all single quotes instead of backticks....
@Kai Qing在对CanSpice答案的评论中提供了解决方案.
推荐答案
您的列可能命名为id
,而不是ID
.列名区分大小写.
Your column is probably named id
, not ID
. Column names are case-sensitive.
这篇关于简单的出站链接跟踪器-为什么不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文