PHP Int布尔值和字符串问题

时间:2015-04-13 14:31:47

标签: php

你好,我有一个问题,目前有点烦恼我已经尝试了一切,我得到的错误是

  

解析错误:语法错误,第23行C:\ wamp \ www \ index.php中的意外'var'(T_VAR)

我正在使用此代码


<html>
<head><title> Panda Project </title></head>
<body>
<?php
session_start();
// Db Details
$servername = "no ip for you";
$username = "no user name for you";
$password = "no password for you";
$database = "remoteaddr";
// Creates Connection To Db
$conn = new mysqli($servername, $username, $password, $database) OR die("Error Connecting : " .  $conn->connect_error);
$remoteconn = $_SERVER['REMOTE_ADDR'];
// Checks Connection To Db
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "<br>";
// Inserts Query
$sql = "INSERT INTO connections (IP)
VALUES ('$remoteconn')";
// Checks Query
var filename = 0;
$get = TRUE;
$file_exists ( "log/atestconnection.txt");
if(file_exists == TRUE) {
    while(get) {
            $sfilename = (string)$filename;
            $check_file = ("log/". $sfilename .".txt");
            if(check_file == TRUE) 
                filename+
            if(check_file == FALSE) {
                rename("log/latestconnection.txt" . $filename . ".txt");
                get = FALSE;
            }
    }
}
system("echo " . $remoteconn . " > log/latestconnection.txt");
if ($conn->query($sql) === TRUE) {
} else {
}
$conn->close();
?>
<table align="center" border=1 width=20 height = 20>
<th> Your IP </th>
<?php
echo "<tr>";
echo "<td> " . $remoteconn . " </td>";
echo "</tr>";
?>
</body></html>

现在我得到此错误解析错误:语法错误,第32行C:\ wamp \ www \ index.php中的意外'if'(T_IF) 我得到了很多Theres 3更多D:!

1 个答案:

答案 0 :(得分:2)

替换var filename = 0;通过$ filename = 0