0

我正在使用以下代码

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
4

1 回答 1

1

您还没有声明任何 $db 对象。改用这个:

$smarty->assign('contact', mysql_fetch_row($sel));
于 2012-08-12T08:40:12.377 回答