我对我认为的语法有点困难。我的一行代码似乎一直在显示。一直显示的代码行是: if($affected_rows >= 1) {?< 可能有什么问题?您在哪里看到评论://---- 检查是否有更新的行。如果 0 行则存在重复并且不会显示灯箱代码这是问题开始的地方。
<HTML>
<HEAD>
<title>NetDocs - The Network Documentation Webpage "Your Resource For BMF Documentation"</title>
</HEAD>
<body>
<?PHP
$link = mssql_connect('localhost', 'mssql_user', 'password');
if(!$link) {
die('Could not connect: ' . mssql_error());
}
//Function to get the vistors IP address
function getUserIP()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
else
{
$ip = $remote;
}
return $ip;
}
//check if this is the first time visit
if(!isset($user_ip){
$user_ip = getUserIP();
$sql ="INSERT INTO USER_IP ('user_ip') VALUES ('" . $user_IP . "');";
$results = mssql_query($sql);
$Affected_Rows = mssql_num_rows($result);
}
//---- checks if there are rows that got updated. if 0 rows then there is a duplicate and will not show the lightbox code
if($affected_rows >= 1) {?< // This is what keeps showing on my site just the 1) {<
<script src="http://cdn.jotfor.ms/static/feedback2.js?3.1.881" type="text/javascript">
new JotformFeedback({
formId:'33084654629158',
base:'http://jotform.us/',
windowTitle:'Registration Form',
background:'#FFA500',
fontColor:'#FFFFFF',
type:false,
height:500,
width:700,
openOnLoad:true
});
</script>
<?php
}
mssql_close($link);
?>
</BODY>
</HTML>