royal27 Posted August 13, 2013 Share Posted August 13, 2013 (edited) I want to put this in homefeatured.tpl but is not showing me the code $coduri = mysql_fetch_array(mysql_query("SELECT codurideaccess FROM marked_cards_factory_product WHERE id_product='".$product.id_product."'")); if($_POST["codurideaccess"]=="$codurideaccess[0]") { echo "something"; }else{ echo "or give error"; } i also tried this one but still dont work,how should i do it? <?php $coduri = mysql_fetch_array(mysql_query("SELECT codurideaccess FROM marked_cards_factory_product WHERE id_product='".$product.id_product."'")); if($_POST["codurideaccess"]=="$codurideaccess[0]") { echo "something"; }else{ echo "or give error"; ?> Edited August 13, 2013 by royal27 (see edit history) Link to comment Share on other sites More sharing options...
safa Posted August 13, 2013 Share Posted August 13, 2013 .tpl files not support sql code. It's a bad idea to request data in a view. Use $smarty->assign in homefeatured.php code to pass values into template. 1 Link to comment Share on other sites More sharing options...
vekia Posted August 13, 2013 Share Posted August 13, 2013 moreover, you use wrong code for database query, it's better to use Db class from prestashop, then your code will be safe. 1 Link to comment Share on other sites More sharing options...
royal27 Posted August 14, 2013 Author Share Posted August 14, 2013 could you give an example?I want something like this $coduri = mysql_fetch_array(mysql_query("SELECT codurideaccess FROM ps_product WHERE id_product='".$product.id_product."'")); if($_POST["codurideaccess"]=="$coduri0]") { echo "Here will be the add to cart button"; }else{ echo "here will be the access form for enter the code";} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now