意外的T_IF错误 [英] unexpected T_IF error
问题描述
好吧,我是php的新手,来自asp背景。
我基本上想做一个If>那么>否则>结束如果声明:
我的页面是:
<?php require_once(''Connections / carresa.php''); ?>
<?php
$ DateTime = date(" Y / n / j");
$ IP = $ _SERVER [" REMOTE_ADDR"];
mysql_select_db($ database_carresa,$ carresa);
$ query_rs =" SELECT count(Hit_DateTime)as mycount FROM unique_ip WHERE
Hit_IP =''$ IP''和hit_datetime =''#$ DateTime#''" ;;
$ rs = mysql_query($ query_rs,$ carresa )或死(mysql_error());
$ row_rs = mysql_fetch_assoc($ rs);
$ totalRows_rs = mysql_num_rows($ rs);
print"< span class = white11>" 。 $ query_rs。 < br> IP:" 。
$ _SERVER [" REMOTE_ADDR"]。 < br>日期时间: 。 $ DateTime。 "< br> Count:" 。
$ row_rs [''mycount'']。 "< / span>"
//此时我想说IF row_rs [''mycount''] == 0然后打印欢迎
页面
if($ row_rs [''mycount''] ==''0''){
print" welcome";
}
?>
第17行的页面错误是if行。
任何想法? ?
谢谢
James Campbell
ok, I am totally new to php and come from an asp background.
I basically want to do an If > then > else > end if statement:
my page is:
<?php require_once(''Connections/carresa.php''); ?>
<?php
$DateTime = date("Y/n/j");
$IP = $_SERVER["REMOTE_ADDR"];
mysql_select_db($database_carresa, $carresa);
$query_rs = "SELECT count(Hit_DateTime) as mycount FROM unique_ip WHERE
Hit_IP = ''$IP'' and hit_datetime = ''#$DateTime#''";
$rs = mysql_query($query_rs, $carresa) or die(mysql_error());
$row_rs = mysql_fetch_assoc($rs);
$totalRows_rs = mysql_num_rows($rs);
print "<span class=white11>" . $query_rs . "<br>IP: " .
$_SERVER["REMOTE_ADDR"] . "<br>Date Time: " . $DateTime . "<br>Count: " .
$row_rs[''mycount''] . "</span>"
//at this point I want to say IF row_rs[''mycount'']== 0 THEN PRINT WELCOME ON
THE PAGE
if ($row_rs[''mycount'']==''0''){
print "welcome";
}
?>
The page errors on line 17 which is the if line.
Any ideas ???
thanks
James Campbell
推荐答案
DateTime = date(" ; Y / n / j");
DateTime = date("Y/n/j");
IP =
_SERVER [" REMOTE_ADDR"];
mysql_select_db(
_SERVER["REMOTE_ADDR"];
mysql_select_db(
这篇关于意外的T_IF错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!