|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jamminjames Smarty Rookie
Joined: 26 Dec 2018 Posts: 5
|
Posted: Fri Dec 28, 2018 7:49 am Post subject: passing row from database: following instructions, no work |
|
|
Smarty doc here https://www.smarty.net/docs/en/api.assign.tpl says I should be able to assign a row from a database like so:
Code: | $sql = 'select id, name, email from contacts where contact ='.$id;
$smarty->assign('contact', $db->getRow($sql)); |
Then, in the template, call it with for example.
I did exactly that, but I'm getting an undefined index error.
I have:
Code: | $sql="select active,companyname from control where id=1";
$smarty->assign('id', $db->getRow($sql)); |
and in the template. What am I doing wrong?
I'm also getting this error:
Quote: | Fatal error: Uncaught Error: Call to undefined method mysqli::getRow() |
...that's a PEAR function, I believe, and I do have that installed and working.
Thanks for any help! |
|
Back to top |
|
jamminjames Smarty Rookie
Joined: 26 Dec 2018 Posts: 5
|
Posted: Fri Dec 28, 2018 8:40 am Post subject: MDB2 package |
|
|
Okay, didn't have PEAR MDB2 package installed, which apparently is needed to run getRow(). It is now installed, and I restarted the Xampp Apache server, but I'm still getting the error. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 01, 2019 4:29 am Post subject: |
|
|
I don't understand, what this has to do with Smarty.
Please make sure the data you pass to Smarty object contains what you expect. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|