<?php /* my function class */
class dbFunctions{
public $dbHost = "localhost",
$dbLogin = "root",
$dbPwd = "",
$dbName = "forex",
$mysqli;
/* Create a new mysqli object with database connection parameters */
public function __construct(){
$this->mysqli = new mysqli($this->dbHost, $this->dbLogin, $this->dbPwd , $this->dbName);
if(mysqli_connect_errno()) {
echo "Connection Failed: " . mysqli_connect_errno();
exit();
}
}
public function address(){
if($stmt = $this->mysqli -> prepare("SELECT `email_content` FROM `content` WHERE `content_name`= ? ")) {
$content = 'address';
$stmt -> bind_param("s", $content);
$stmt -> execute();
$stmt -> bind_result($result);
$stmt -> fetch();
$stmt -> close();
echo $result;
}
}
}
$obj = new dbFunctions() ;
?>
<!-- MY FOOTER FILE WHERE I CALLED THE FUNCTION-->
<div id="address">
<a href="#" style="color:#fff; text-decoration:none;"> Contact Us:</a>
<?php if(!empty($obj->address())){?><?php $obj->address();?>
<?php }?>
</div>
致命錯誤:無法在C:\ wamp \ www \ forex \ includes \ footer.html中的寫入上下文中使用方法返回值在線3PHP CLASS - 致命錯誤:無法在寫入上下文中使用方法返回值
請幫我解決這個問題..我搜索了很多,並沒有找到任何解決方案。
可能重複不能使用其實現方法具d返回值在寫入上下文](http://stackoverflow.com/questions/1075534/cant-use-method-return-value-in-write-context) – Pupil
請參閱這裏:http://stackoverflow.com/questions/1075534/cant-use-method-return-value-in-write-context – Pupil