0

I am working in phpfox.I want to use smarty variable in mysql query. I have searched a lot and apply all methods / solutions available in stackoverflow but its not working.

yogeshK
  • 195
  • 4
  • 19
  • what did you try, pls show your code – Sibu Nov 17 '12 at 09:13
  • My smarty vaiable value = $aPin.ITEMID Now I want to use this value in below query: $q= "SELECT Count( DISTINCT `user_id` ) AS totalMembers FROM phpfox_event_invite WHERE event_id =$aPin.ITEMID" – yogeshK Nov 17 '12 at 09:15

1 Answers1

0

Use get_template_vars to get template variable in php code

$myVar = $smarty->get_template_vars('aPin');
echo $myVar.ITEMID;

Also try get_template_vars() to get the list of all assigned variables

$myvar = $smarty->get_template_vars();
print_r($myvar);
Sibu
  • 4,609
  • 2
  • 26
  • 38
  • Appreciated for your quick response, I have used this solution but this is not working in my case. – yogeshK Nov 17 '12 at 09:20
  • Please post your code in your question, otherwise it is really hard for us to help you. – Botond Balázs Nov 17 '12 at 09:25
  • I have given code in comment also like my value in smarty variable like {$aPin.ITEMID} now I want to use this in mysql query like for an exa. select from Tablename where is = {$aPin.ITEMID} but not working. – yogeshK Nov 17 '12 at 09:29
  • @yogeshK what output are you getting from $smarty->get_template_vars() ?? – Sibu Nov 17 '12 at 09:35