简体   繁体   English

聪明的致命错误

[英]Smarty fatal error

I am using the following code 我正在使用以下代码

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');

I am getting error: 我收到错误消息:

Fatal error: Call to a member function getRow() on a non-object in D:\xampp\htdocs\smarty\testfun.php on line 21

You haven't declared any $db object. 您尚未声明任何$ db对象。 Use this instead: 使用此代替:

$smarty->assign('contact', mysql_fetch_row($sel));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM