Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

can somebody help to check database

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Help Wanted (commercial)
View previous topic :: View next topic  
Author Message
avay
Smarty n00b


Joined: 02 Sep 2009
Posts: 3

PostPosted: Wed Sep 02, 2009 10:08 am    Post subject: can somebody help to check database Reply with quote

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
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Wed Sep 02, 2009 11:22 am    Post subject: Re: can somebody help to check database Reply with quote

Have you tried a tpl like this?

Code:
{if $qrydisplay}
     //display records
{else}
     // no record found
{/if}
Back to top
View user's profile Send private message
avay
Smarty n00b


Joined: 02 Sep 2009
Posts: 3

PostPosted: Thu Sep 03, 2009 9:41 am    Post subject: ya i tried Reply with quote

ya i have tried but could not get anything even though there is no record
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Thu Sep 03, 2009 11:00 am    Post subject: Reply with quote

Did you get any output with

Code:
{$qrydisplay}
Back to top
View user's profile Send private message
avay
Smarty n00b


Joined: 02 Sep 2009
Posts: 3

PostPosted: Fri Sep 04, 2009 5:01 am    Post subject: ya Reply with quote

i got no output.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Fri Sep 04, 2009 5:44 am    Post subject: Re: can somebody help to check database Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Help Wanted (commercial) All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP