PilotCart Support Forum
PilotCart Support Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snippets
 Web Store Snippets
 FUNCTION: Get one data field from the database
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

zwemkec
Moderator

USA
713 Posts

Posted - 02/13/2008 :  10:46:15 AM  Show Profile  Visit zwemkec's Homepage  Reply with Quote
'-------------------------------------------------------------------------------------  
'  FunctionToPullASingleDataField
' ---------------------  
'  Pulls a single data field and returns that field
'
'EXAMPLE USAGE:  Response.Write FunctionToPullASingleDataField("default")
'----------------------------------------------------------------   
Function FunctionToPullASingleDataField(strParmeterPassedIn)
     Dim strSQL '// your SQL statement to tell the database what data you want.
     Dim arrRS '//this will hold the array of data returned from the database
     Dim strOutput '//this variable will hold the output.  In case you need to fuss with it before returning.     
     '// define the SQL statement you will feed to the database
     strSQL = "SELECT PG_HEADER FROM TBLPAGES WHERE PG='"&strParmeterPassedIn&"'"
     '//Use a special PilotCart only function to open the database
     '/ this function either returns an array, or NULL
     arrRS = OpenArrayRS(strSQL) '//passing it the SQL statement you constructed
     '//Check the connection contains data of some sort
     If NOT IsNULL(arrRS) Then
		'//Grab the data
		'// See another post on how to know what numbers to put here.
		strOuptut = arrRS(0,0)
		'//Close the object containing the data so the server doesn't crash later
		Erase arrRS
	 Else
		strOuptut = "Sorry Nothing Was Found"
     End If
     '//All functions have to return data.  This is where we make the variable strOutput
     '/ be the returned value
     FunctionToPullASingleDataField = strOuptut
End Function


<%
Chris Zwemke
chris @ scarabmedia . com
www.pilotcart.com
%>
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
PilotCart Support Forum © 2008 Spliethof Inc dba PilotCart.com Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06