Jason, After looking at this a little more, the variable aren't being changed into their value. The echo looks like this: 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 and a.team_div = $div group by a.name order by Results desc limit '$display' As you can see the variables aren't being changed, any ideas? Thanks -Rich -----Original Message----- From: Jason Walker [mailto:desktophero@xxxxxxx] Sent: Tuesday, June 07, 2005 6:54 PM To: 'ReClMaples' Subject: RE: Can someone help me out? In your PHP page, can you echo the actual query variable to the browser and send that to the mail group? I don't necessary see anything 'wrong' with your query but see the three variables, as they are interpreted by PHP, may help. Thanks, -----Original Message----- From: ReClMaples [mailto:reclmaples@xxxxxxxxxxxxx] Sent: Tuesday, June 07, 2005 4:05 PM To: PHP Subject: Can someone help me out? 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 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.5 - Release Date: 6/7/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php