Is your query wrapped in single quotes, instead of double quotes? Variable expansion, of course, doesn't occur under single quotes. :)

ReClMaples wrote:

I am having a problem getting a sql statement to run.

I have this in a table called stat_categories, in a field called sql2

select a.name,a.position,a.team,sum(b.yards) as Results from player
a,passing b
where
a.player_num = b.player_num
and a.position = '$pos'
and b.year >= '$year'
group by a.name
order by Results desc
limit '$display'

when I try to display this I get this error:

You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near ''$display'' at
line 8

I tried removing the ‘’s but this didn’t help.

If I put in the sql instead of the variable, it works fine.  What am I doing
wrong?

Any help would be greatly appreciated.

Thanks
-Rich


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to