NoPHPPhD Posted November 16, 2006 Share Posted November 16, 2006 Hi,I get an error on this line.Space in column name is issue.fat mono is a decimal 5,3. mgrams is decimal 5,3.Thanks,[code]$fatm += ($row->fat mono * $row->mgrams / 100);[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted November 16, 2006 Share Posted November 16, 2006 You cannot use spaces. Quote Link to comment Share on other sites More sharing options...
NoPHPPhD Posted November 16, 2006 Author Share Posted November 16, 2006 crap, i was hoping that was not the answer. Quote Link to comment Share on other sites More sharing options...
btherl Posted November 16, 2006 Share Posted November 16, 2006 You can use underscores, which look visually similar to spaces.[code=php:0]$fatm += ($row->fat_mono * $row->mgrams / 100);[/code]And you can rename the columns from the query appropriately by selecting "`fat mono` AS fat_mono", if this is database results you are dealing with. Or you can fetch the data as an array instead of an object. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.