0
在我的PHP應用程序中使用ezSQL我有一個問題。從另一個文件中使用ezSQL函數
這是我的結構
的config.php代碼:
include_once "ez_sql_core.php";
include_once "ez_sql_mysql.php";
$db = new ezSQL_mysql('myuser','mypass','mydb','localhost');
的index.php代碼:
include('includes/config.php');
include('includes/functions.php');
echo prueba();
的functions.php代碼:
function prueba()
{
$users = $db->get_results("SELECT * FROM users");
foreach ($users as $user)
{
echo $user->user;
}
}
,但我得到這個錯誤:
Fatal error: Call to a member function get_results() on a non-object in /web/htdocs/mydomain/includes/functions.php on line 7
我怎樣才能解決呢?
謝謝!
非常感謝! – Klian