Marcel Wasilewski
Marcel Wasilewski

Reputation: 2679

PHP Smarty Tag in SQL query

i am working on a shop that uses smarty tag. I want to do following sql query:

{php}
    $sql = "SELECT intraship_shipmentnumber FROM orders WHERE orders_id = {$ORDER_NUMBER} ";
{/php}

when i insert a static order number the sql query works, but it does not work with the smarty tag and i poorly have no idea how to insert it so it works.

Upvotes: 1

Views: 122

Answers (2)

Marcel Wasilewski
Marcel Wasilewski

Reputation: 2679

I already found a solution myself. Here it is for anyone who is interested:

First you assign a variable via Smarty:

{assign var=test value=$ORDER_NUMBER}

Then you can put this in a PHP Variable which you can use:

$order = $this->get_template_vars('test');

Upvotes: 1

Alex
Alex

Reputation: 17289

I am not an Smarty expert. But could you try:

{php}
    $sql = "SELECT intraship_shipmentnumber FROM orders WHERE orders_id = {/php}{$ORDER_NUMBER}{php} ";
{/php}

Upvotes: 0

Related Questions