我正在使用以下代码
require 'Smarty/libs/Smarty.class.php';
$smarty = new Smarty;
$sel=mysql_query("select id, name from form");
$smarty->assign('contact', $db->getRow($sql));
$smarty->display('testfunction.tpl');
我收到错误:
Fatal error: Call to a member function getRow() on a non-object in D:\xampp\htdocs\smarty\testfun.php on line 21
答案 0 :(得分:1)
您尚未声明任何$ db对象。 请改用:
$smarty->assign('contact', mysql_fetch_row($sel));