Jon,
Sorry yes I saw that a few minutes ago (doh!)
The code that doesn't work 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 code that does work 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"
//}
?>
<?php if ($row_rs['mycount']=="0"){ ?>
<br>ddddd
<?php } ?>
Seems strange how I can't include the bottom bit of code in the main chunk
of code ??
Cheers
James
"Jon Kraft" <jo*@jonux.co.uk> wrote in message
news:Xn**************************@130.133.1.4...
"James Campbell" <ja***@stuttersystems.com> wrote:
Thanks for replying, I have tried both your suggestions, but still get
the error. My current code is:
if ($row_rs['mycount']===0){
print "welcome"
}
If I however put the code in like this:
<?php if ($row_rs['icount']=="0"){ ?>
<br>ddddd
<?php } ?>
The page works.
Any ideas ??
Hi James,
That doesn't make sense ... but you are using two different keys in your
example: 'mycount' and 'icount'. Could you post the complete code again?
JOn