Jump to content

Archived

This topic is now archived and is closed to further replies.

Drezard

Unexpected ";"

Recommended Posts

Hello i get this error:

[QUOTE]
Parse error: syntax error, unexpected ':' in /home/wintersw/public_html/class.php on line
[/QUOTE]

With this code: I cant work it out:

[CODE]
<?php

session_start();

error_reporting(E_ALL);

class web {

public $page;

function get_ip() {

$ip = trim($_SERVER['REMOTE_ADDR']);

return $ip;

}

function connect() {

$user = "wintersw_drezard";
$pass = "250291";
$host = "localhost";
$db = "wintersw_wintersword";

$connect = mysql_connect($host, $user, $pass) or die ("Error: Unable to connect to MySql");
   
    mysql_select_db($db) or die ("Error: Unable to select MySql database");

}

function log_time() {

$time = date(h:i:s-m-d-y);

return $time;
}

function log_timeip() {

$time = $this->log_time();

$ip = $this->get_ip();

$this->connect();

$query = "INSERT INTO ip_viewlog(ip, time) VALUES ('$ip', '$time')";

$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
}
}
[/CODE]

Share this post


Link to post
Share on other sites
change your $time variable to this:

[code=php:0]$time = date("h:i:s-m-d-y");[/code]
i have a feeling thats the error...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.