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] Link to comment https://forums.phpfreaks.com/topic/27399-proble-with-space-in-column-name/ Share on other sites More sharing options...
trq Posted November 16, 2006 Share Posted November 16, 2006 You cannot use spaces. Link to comment https://forums.phpfreaks.com/topic/27399-proble-with-space-in-column-name/#findComment-125309 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. Link to comment https://forums.phpfreaks.com/topic/27399-proble-with-space-in-column-name/#findComment-125312 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. Link to comment https://forums.phpfreaks.com/topic/27399-proble-with-space-in-column-name/#findComment-125313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.