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
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?

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.