|
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 |
avay Smarty n00b
Joined: 02 Sep 2009 Posts: 3
|
Posted: Wed Sep 02, 2009 10:08 am Post subject: can somebody help to check database |
|
|
I am new for smarty, so i want some help from u.
I am practicing in simple search using PHP and Smarty. I have retrieved data from the database. If an user selects correct field then the result should display all the records and if the record does not find, it should be displayed as "No Record" .
Here is the code ::
##########################################
// using calling method getProductQuery()
$this->assign('qrydisplay', $this->getProductQuery());
## now in .tpl file i want like this
if(qrydisplay exist)
{
//display records
}
else
{
// no record found
}
####################################
can some body help me! |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Wed Sep 02, 2009 11:22 am Post subject: Re: can somebody help to check database |
|
|
Have you tried a tpl like this?
Code: | {if $qrydisplay}
//display records
{else}
// no record found
{/if} |
|
|
Back to top |
|
avay Smarty n00b
Joined: 02 Sep 2009 Posts: 3
|
Posted: Thu Sep 03, 2009 9:41 am Post subject: ya i tried |
|
|
ya i have tried but could not get anything even though there is no record |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Thu Sep 03, 2009 11:00 am Post subject: |
|
|
Did you get any output with
|
|
Back to top |
|
avay Smarty n00b
Joined: 02 Sep 2009 Posts: 3
|
Posted: Fri Sep 04, 2009 5:01 am Post subject: ya |
|
|
i got no output. |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Fri Sep 04, 2009 5:44 am Post subject: Re: can somebody help to check database |
|
|
Any output in php with
Code: | echo $this->getProductQuery(); |
Is there an assign in php from $this to $smarty?
Code: | $this->assign('qrydisplay', $this->getProductQuery()); |
Maybe this would be better
Code: | $smarty->assign('qrydisplay', $this->getProductQuery()); |
http://www.smarty.net/manual/en/api.assign.php |
|
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
|