Jump to content

[SOLVED] simple php mssql_query question


knowram

Recommended Posts

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

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?

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.