$t variable in a query

I am trying to make a change to a php program,
Could you see the error

$t = $_SESSION[f_or_temp_data][f_or_st_id];
$query = "select vinalux.fabric, size.size_height_max, price.size_key
from vinalux join (size, price)
where price.size_key = $t";

I get the error

Could Not Execute SQL statementYou have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server version for the
right syntax to use near ' price.size_key = f2 order by vinalux.fabric,
size.size_wi


Could you give me a clou
thanks for your time

Fedor
fedor [ Do, 26 Oktober 2006 19:51 ] [ ID #1514652 ]

Re: $t variable in a query

fedor wrote:
> I am trying to make a change to a php program,
> Could you see the error
>
> $t = $_SESSION[f_or_temp_data][f_or_st_id];
> $query = "select vinalux.fabric, size.size_height_max, price.size_key
> from vinalux join (size, price)
> where price.size_key = $t";
>
> I get the error
>
> Could Not Execute SQL statementYou have an error in your SQL syntax.
> Check the manual that corresponds to your MySQL server version for the
> right syntax to use near ' price.size_key = f2 order by
> vinalux.fabric, size.size_wi
>
>
> Could you give me a clou
> thanks for your time
>
> Fedor

Try:
$t = $_SESSION[f_or_temp_data][f_or_st_id];
$query = "select vinalux.fabric, size.size_height_max, price.size_key
from vinalux join (size, price)
where price.size_key = '$t'";
Paul Lautman [ Do, 26 Oktober 2006 20:11 ] [ ID #1514653 ]

Re: $t variable in a query

fedor wrote:
> I am trying to make a change to a php program,
> Could you see the error
>
> $t = $_SESSION[f_or_temp_data][f_or_st_id];
> $query = "select vinalux.fabric, size.size_height_max, price.size_key
> from vinalux join (size, price)
> where price.size_key = $t";
>
> I get the error
>
> Could Not Execute SQL statementYou have an error in your SQL syntax.
> Check the manual that corresponds to your MySQL server version for the
> right syntax to use near ' price.size_key = f2 order by vinalux.fabric,
> size.size_wi
>
>
> Could you give me a clou
> thanks for your time
>
> Fedor

Maybe it should be price.size_key = 'f2' order by vinalux.fabric...
zac.carey [ Do, 26 Oktober 2006 20:14 ] [ ID #1514654 ]
PHP » alt.php.sql » $t variable in a query

Vorheriges Thema: mis behaven variable or what is going on
Nächstes Thema: Problem with SELECT