knowram Posted July 30, 2008 Share Posted July 30, 2008 I remember seeing somewhere that you can change the name of the variable you are selecting in the select statement but i can't remember how to do it. something like select DevicePool.Name as DPName so that in the rest of the page I can refer to that variable as DPName not Name. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/117371-solved-simple-php-mssql_query-question/ Share on other sites More sharing options...
pocobueno1388 Posted July 30, 2008 Share Posted July 30, 2008 Your doing it correctly. Usually you would only do that if you had two tables with the same field name and you had to differentiate between the two...or if you were selecting the sum of two fields or something like that. But what your doing should work. Have you tried it? Link to comment https://forums.phpfreaks.com/topic/117371-solved-simple-php-mssql_query-question/#findComment-603687 Share on other sites More sharing options...
knowram Posted July 30, 2008 Author Share Posted July 30, 2008 hmm here is what I have $iptL = mssql_query("select DevicePool.Name, Device.Description, Device.Name as Mac from DevicePool JOIN Device ON DevicePool.pkid = Device.fkDevicePool JOIN DeviceNumPlanMap ON Device.pkid = DeviceNumPlanMap.fkDevice JOIN NumPlan ON DeviceNumPlanMap.fkNumPlan = NumPlan.pkid WHERE NumPlan.DNOrPattern = '$iptDevice[DNOrPattern]' AND Device.Name NOT LIKE 'ADP%'"); $iptLab = mssql_fetch_array($iptL, MSSQL_ASSOC); then when i try to call on $iptLab['Mac'] i get an error. Link to comment https://forums.phpfreaks.com/topic/117371-solved-simple-php-mssql_query-question/#findComment-603738 Share on other sites More sharing options...
DarkWater Posted July 30, 2008 Share Posted July 30, 2008 They're called aliases. I know for a fact that MySQL supports them, but MSSQL may not. Research it a bit. Link to comment https://forums.phpfreaks.com/topic/117371-solved-simple-php-mssql_query-question/#findComment-603743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.