I have 2 php files and in my index file im just getting a function but its returning 2 echo's instead of just one.
index.php
<?php
require_once 'config_db.php';
require_once 'database_class.php';
$db = new database($conDB);
echo '<br/>';
$fetch = $db->getData();
?>
other file
<?php
include('index.php');
class database{
function __construct($conDB)
{
$this->conDB = $conDB;
}
function getData()
{
$clientIP = $_SERVER['REMOTE_ADDR'];
echo $clientIP;
$query = $this->conDB->prepare("
INSERT INTO `ip log` (`Address`)
VALUES ('$clientIP')
");
$query->execute();
}
}
?>