Login   Register  
PHP Classes
elePHPant
Icontem

File: Example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ismet Ozalp  >  MsSQL Database Functions  >  Example  >  Download  
File: Example
Role: Documentation
Content type: text/plain
Description: Example
Class: MsSQL Database Functions
Microsoft SQL server database access wrapper
Author: By
Last change: Warning Added
Date: 2006-01-21 22:21
Size: 2,273 bytes
 

Contents

Class file image Download
MsSQL Class by Ismet Ozalp
mailto:xsdenied@phreaker.net

System Requirements
PHP5 and MsSQL 2000

Installation
please do not forget to set the variable $path2Languages in the file config.inc.php

Stored Procedure Call Example
		
		$parameters[0]["parameter"]="@UserType";
		$parameters[0]["type"]=SQLVARCHAR;
		$parameters[0]["variable"]="Student";
		
		$parameters[1]["parameter"]="@Username";
		$parameters[1]["type"]=SQLVARCHAR;
		$parameters[1]["variable"]="$_POST[Username]";
	
		$parameters[2]["parameter"]="@Password";
		$parameters[2]["type"]=SQLVARCHAR;
		$parameters[2]["variable"]="$_POST[Password]";
		
		$parameters[3]["parameter"]="@ThemeID";
		$parameters[3]["type"]=SQLINT4;
		$parameters[3]["variable"]=$_SESSION["ThemeID"];
		
		$parameters[4]["parameter"]="@LanguageID";
		$parameters[4]["type"]=SQLINT4;
		$parameters[4]["variable"]=$_SESSION["LanguageID"];
		
		$parameters[5]["parameter"]="@WebPage";
		$parameters[5]["type"]=SQLVARCHAR;
		$parameters[5]["variable"]="$_POST[WebPage]";
		
		$parameters[6]["parameter"]="@Email";
		$parameters[6]["type"]=SQLVARCHAR;
		$parameters[6]["variable"]="$_POST[Email]";
		
		$parameters[7]["parameter"]="@GovermentalID";
		$parameters[7]["type"]=SQLVARCHAR;
		$parameters[7]["variable"]="$_POST[GovID]";	
		
		$parameters[8]["isOutput"]=True; //Defining output parameter
		$parameters[8]["isNull"]=False;
		$parameters[8]["parameter"]="@return";
		$parameters[8]["type"]=SQLINT4;
		$parameters[8]["variable"]="";
		
		$MsSql=new MsSQL("English");
		$resultSet=$MsSql->SP_CALL("AddUser",$parameters,"");
		$resultSet[0]; ==>this variable has return value...

		$query_result=$MsSql->query("Select * From Users"); ==>query example

		$filled_array=$MsSql->getArray("Select * From Users");

		/*
			returns all the query in a table like
			if there are only one user in the Users
			the values will be
			$filled_array[0]["UserType"]        }
			$filled_array[0]["Username"]	    }
			$filled_array[0]["Password"]	    }
			$filled_array[0]["ThemeID"]	    }
			$filled_array[0]["LanguageID"]	    }===>All values are setted!
			$filled_array[0]["WebPage"]	    }
			$filled_array[0]["Email"]	    }
			$filled_array[0]["GovermentalID"]   }

		*/