Tutorial:
Database - PHP - Search Security Users By Name With Access Database
Dr.
Thomas E. Hicks
Computer Science
Department
Trinity University
IIS 5 Install on Windows XP Pro
IIS 5 Installation on Windows 2000 Pro/Server
It might even help to read a tutorial that describes the need for Database Web Applications.
Database Need For Web Applications
You may use the basic ideas of this tutorial for either the ODBC connection or the MapPath connection..
Database - PHP - ODBC Connections
Database - PHP - MapPath Connections
For purposes of discussion, let us suppose that an Access Database, called Security.mdb, resides at the root of drive C. (See Below!) When a database is installed on the web server, the necessary ODBC drivers are also installed. If the web server does not have the database installed, then the ODBC drivers will have to be downloaded and installed; this process differs from database to database and is beyond the scope of this paper. Microsoft Access and the appropriate ODBC drivers have been installed on the server illustrated below.

The Security Database is opened and the Tables tab is selected; in order to keep our example simplistic, the Security Database has only a single table, called Users. The contents of our very simple Users table can be seen below.

Each record in the Users table contains fields Name, No, Password, and IDNo; these will be needed later.

The datatypes of each field may be seen below.

The Security Database above was is ultra trivial application which had only one database table. Relational databases often have many tables; this is true of Access databases as well. This database may be downloaded.
We are going to place all of the PHP files in folder C:\Inetpub\wwwroot\PHP. We could place the database files anywhere on the drive. For security reasons, it is not a good idea to place them in the wwwroot directory.

For purposes of this tutorial, we shall assume that the Security database files are located in C:\Security. For purposes of this tutorial, we shall assume that the Security database is located in C:\.
File adodb.inc.php includes many of the database PHP4 extensions to php. File adodb-time.inc.php is used by adodb.inc.php. These should be placed in the web site. I have chosen to place them in directory ADODB for purposes of this tutorial..

There is PHP support for many databases; among them are Oracle, informix, mysql, ibase, cvc, postgres, sybase, foxpro, etc. Each of these shall require its own driver. Although you shall not neeed all of the drivers, I have placed a collection that I downloaded from the Internet in directory Drivers. See Below! These should be placed in the web site. I have chosen to place them in directory ADODB for purposes of this tutorial..

You might want to download your own files from the Internet, but for sake of simplicity, I have included those used in the tutorial in the zipped file below; place them in a folder, called ADODB, at the root of your IIS directory. (See Below!)

The first page shall be called SearchSecurityUserByName.php. It shall be the responsibility of this page to prompt the user for a SearchName and transfer processing control to the second page.
The second page shall be called SearchSecurityUserByNameConfirmation.php. It shall be the responsibility of this page to display all of the Users that match the SearchName. Control shall pass to a generic Error.php page in the event that the SearchName is blank. Control shall also pass to Error.php if there are no users with SearchName.
<?PHP #========================================================================= #========================================================================= #==== SearchSecurityUserByName.php ==== #========================================================================= #==== ==== #==== Purpose : Prompt the user for the User Name & transfer ==== #==== to page SearchUserByNameConfirmation.php for ==== #==== processing. ==== #==== ==== #==== Written By : Dr. Thomas E. Hicks Date: 08/1/2003 ==== #========================================================================= #========================================================================= |
The documentation block provides a brief statement of purpose.
#--------------------------------------------------------------------------
# This block of code starts a new session and clears any session
# variables. It shall make sure that the input boxes on this form
# are initially blank; session variables shall store a copy of the
# user responses in all input boxes so that they may be reloaded on
# the page in the event that the user must return back to this page
# because of invalid input. The PreviousPage variable shall
# enable the corresponding confirmation page to assure that it is
# only called from this page.
#--------------------------------------------------------------------------
If (!IsSet($NewSearchName))
{
Session_Start();
Session_UnSet();
$NewSearchName = "";
$PreviousPage = "SearchName1";
$SearchName = "";
Session_Register("NewSearchName");
Session_Register("PreviousPage");
}
Els
$SearchName = $_SESSION["NewSearchName"];
$_SESSION["PreviousPage"] = "SearchName1";
?>
|
This block of code starts a new session and clears any session variables. It shall make sure that the input boxes on this form are initially blank; session variables shall store a copy of the user responses in all input boxes so that they may be reloaded on the page in the event that the user must return back to this page because of invalid input. The PreviousPage variable shall enable the corresponding confirmation page to assure that it is only called from this page.
<HTML> <HEAD><TITLE>Dr. Thomas E. Hicks - SearchSecurityUserByName.php</TITLE> </HEAD> |
The HTML places Dr. Thomas E. Hicks - SearchSecurityUserByName.php in the browser title bar.
<BODY TEXT = "#000000"
BGCOLOR = "#000000"
VLINK ="#000000"
ALINK ="#000000"
BACKGROUND ="Paper.jpg">
|
This HTML code above defines the page background, the default text color, the default background color, and the default link colors.
<CENTER><FONT FACE ="Arial" SIZE="4">SearchSecurityUserByName.php<BR> Written By<BR>Dr. Thomas E. Hicks</FONT></CENTER><HR> |
The HTML code above creates the following commercial at the top of the page.
SearchSecurityUserByName.php
Written By
Dr. Thomas E. Hicks
<FORM METHOD = "GET"
ACTION = "SearchSecurityUserByNameConfirmation.php">
|
This is a standard HTML form which
shall provide the user an opportunity to enter information and submit/transfer
that information to page SearchSecurityUserByNameConfirmation.php.
You can see that the Get Method passes the SearchName variable in the URL when
control is submitted/passed to page SearchSecurityUserByNameConfirmation.php.
You can visibly see Tom passed in the URL below.
![]()
<TABLE BORDER = "5"
CELLPADDING = "4"
CELLSPACING = "4"
STYLE = "border-collapse: collapse"
BORDERCOLOR = "#800000"
BGCOLOR = "#FFFFFF"
WIDTH = "100%" >
|
A table shall be used to organize the prompts, buttons, and input boxes.
<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Display Users With Name
<INPUT TYPE = "Text"
VALUE = "<?PHP Print $SearchName ?>"
NAME = "SearchName"
SIZE = 20
MAXSIZE = 20></B></FONT>
</TD></TR>
|
In the first row of the table shall be a prompt ==> Display Users With Name ==> and a 20 character text box in which to enter the information.. Note that the name of the textbox is SearchName; the get method will transfer this information to the confirmation page.
<TR><TD>
<INPUT TYPE = "SUBMIT"
VALUE = "Display all Users With This Name Now!"
STYLE = "BACKGROUND=BLUE; COLOR=#FFFFFF ;CURSOR=hand;
FONT-FAMILY ='SYSTEM';FONT-SIZE=10pt">
</TD></TR>
|
The second row of the table shall contain a blue submit button whose caption is Display All Users With This Name Now!
</TABLE></FORM> </BODY></HTML> |
The remainder of the HTML code above simply ends the table, the form, the body, and the document.
The complete code may be found below. A working model may be found at
<?PHP #========================================================================= #========================================================================= #==== SearchSecurityUserByName.php ==== #========================================================================= #==== ==== #==== Purpose : Prompt the user for the User Name & transfer ==== #==== to page SearchUserByNameConfirmation.php for ==== #==== processing. ==== #==== ==== #==== Written By : Dr. Thomas E. Hicks Date: 08/1/2003 ==== #========================================================================= #========================================================================= ?> <HTML>
<HEAD><TITLE>Dr. Thomas E. Hicks - SearchSecurityUserByName.php</TITLE>
</HEAD>
<BODY TEXT = "#000000"
BGCOLOR = "#000000"
VLINK ="#000000"
ALINK ="#000000"
BACKGROUND ="Paper.jpg">
<CENTER><FONT FACE ="Arial" SIZE="4">SearchSecurityUserByName.php<BR>
Written By<BR>Dr. Thomas E. Hicks</FONT></CENTER><HR>
<FORM METHOD = "GET"
ACTION = "SearchSecurityUserByNameConfirmation.php">
<TABLE BORDER = "5"
CELLPADDING = "4"
CELLSPACING = "4"
STYLE = "border-collapse: collapse"
BORDERCOLOR = "#800000"
BGCOLOR = "#FFFFFF"
WIDTH = "100%" >
<TR><TD ALIGN = "Right"><FONT FACE ="Arial" SIZE="3" COLOR = "#0000FF"><B>
Display Users With Name
<INPUT TYPE = "Text"
VALUE = = "<?PHP Print $SearchName ?>"
NAME = "SearchName"
SIZE = 20
MAXSIZE = 20></B></FONT>
</TD></TR>
<TR><TD ALIGN = "Center">
<INPUT TYPE = "SUBMIT"
VALUE = "Display all Users With This Name Now!"
STYLE = "BACKGROUND=BLUE; COLOR=#FFFFFF ;CURSOR=hand;
FONT-FAMILY ='SYSTEM';FONT-SIZE=10pt">
</TD></TR>
</TABLE></FORM>
</BODY></HTML>
|
You can see the results below:

<?PHP #========================================================================= #========================================================================= #==== SearchSecurityUserByNameConfirmation.php ==== #========================================================================= #==== ==== #==== Purpose : Transfer to page Error.php and report error if ==== #==== user does not enter the Sought Name. Transfer ==== #==== to page Error.php and report error if the ==== #==== search comes up empty. Display all users that ==== #==== match the search query. ==== #==== ==== #==== Written By : Dr. Thomas E. Hicks Date: 08/1/2003 ==== #========================================================================= #========================================================================= |
The documentation block provides a brief statement of purpose. Immediately following the documentation block are declarations for all of the variables used on this page. Blocks of PHP code begin with <?PHP and end with ?>.
#--------------------------------------------------------------------------
# Include The Database Utilities
#--------------------------------------------------------------------------
Include('../adodb/adodb.inc.php');
|
Include file adodb.inc.php which contains many of the database access extensions to PHP.
#--------------------------------------------------------------------------
# May Only Enter This Page From SearchSecurityUserByName.php!
#--------------------------------------------------------------------------
If ($_SESSION["PreviousPage"] != "SearchName1" )
{
Print "<Script Language = 'JavaScript'> " .
"window.location = 'SearchSecurityUserByName1.php'</Script>";
Print " ";
Exit;
}
|
This block of code starts a new session and clears any session variables. It shall make sure that the input boxes on this form are initially blank; session variables shall store a copy of the user responses in all input boxes so that they may be reloaded on the page in the event that the user must return back to this page because of invalid input. The PreviousPage variable shall enable the corresponding confirmation page to assure that it is only called from this page.
#-------------------------------------------------------------------------- # Declarations & Initializations #-------------------------------------------------------------------------- $Counter = 1; $SearchName = Trim($_REQUEST["SearchName"]); $_SESSION["NewSearchName"] = Trim($_REQUEST["SearchName"]); |
Initialize Counter to 1. Fill SearchName with the trimmed value from the form on page SearchSecurityUserConfirmation.php
#--------------------------------------------------------------------------
# Make Sure That SearchName Is Not Blank!
#--------------------------------------------------------------------------
If (StrLen($SearchName) == 0)
{
$ErrorMessage = "The Sought Name May Not Be Blank!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
|
If the user fails to enter a SearchName, then the length will be zero. A successful search requires the SearchName to be greater than zero. In the event that the user leaves the SearchName blank, a session variable, describing the error, is created and the generic Error.php is loaded to display the error. The extra Print and Exit simply delay the processing so that things work in synch.
#--------------------------------------------------------------------------
# Access Database RealPath Connect To The Server
#--------------------------------------------------------------------------
#------------------------ Create A Connection Object ----------------------
$Conn = New COM("ADODB.Connection");
#------------------------------ Absolute Path -----------------------------
$ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .
RealPath("C:\Security.mdb");
#------------------------------ Relative Path -----------------------------
$ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .
RealPath("../../../Security.mdb");
#--------------------------------- Connect --------------------------------
$Conn->Open($ConnStr);
|
The block of code above connects this page to the Security database. A connection object is created. Variable ConnString contains part of the connection arguments. The Conn->Open opens the Security database and associates it with the connection object. You may use either the Relative Path or the Absolute Path; you need not include both.
#--------------------------------------------------------------------------
# Read All Of The User Names Into The RecordSet
#--------------------------------------------------------------------------
#--------------------------- Traditional SQL Query ------------------------
$UserSQL = " SELECT * " .
" FROM Users " .
" WHERE Name Like '%" . $SearchName . "%'" ;
#------------- Create A Record Set That Contains Results Of Query ---------
$UsersRecordSet = $Conn->Execute($UserSQL);
|
The SQL query is to select all of the information about those users whose Name contains the SearchName. The UserRecordSet object is created and filled with those matches, if any.
#------- If No Record Set Was Generated, Print Out The Error Message ------
If (!$UsersRecordSet)
{
$ErrorMessage = "System Error - Unable To Generate Record Set!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
|
If the record set is not created, then there is a definite error; a session variable, describing the error, is created and the generic Error.php is loaded to display the error.
#------- If There Are No Records In The Record Set, Display Message -------
If ($UsersRecordSet->EOF)
{
$ErrorMessage = "There Are No Records Matching This Sought Name!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
|
If the user enters a SearchName that is not found in the Users table, then the record set will be empty and EOF will be true. In the event that the query is unsuccessful, a session variable, describing the error, is created and the generic Error.php is loaded to display the error.
#------------------ There Are Records To Display --------------------------- $Name = $UsersRecordSet->Fields(0); $No = $UsersRecordSet->Fields(1); $Password = $UsersRecordSet->Fields(2); $ID = $UsersRecordSet->Fields(3); ?> |
Variables Name, No, Password, and ID are filled from the current record in the record set.
<HTML><HEAD> <TITLE>Dr. Thomas E. Hicks - SearchSecurityUserConfirmation.php </TITLE> </HEAD> |
The HTML places Dr. Thomas E. Hicks - SearchSecurityUserByNameConfirmation.php in the browser title bar.
<BODY TEXT = "#000000" BGCOLOR = "#000000" VLINK ="#000000" ALINK ="#000000" BACKGROUND ="Paper.jpg"> |
This HTML code above defines the page background, the default text color, the default background color, and the default link colors.
<CENTER> <font face="Arial" size="4">SearchSecurityUserConfirmation.php<br> Written By<br> Dr. Thomas E. Hicks</font></p> </CENTER> <hr> |
The HTML code above creates the following commercial at the top of the page.
SearchSecurityUserByNameConfirmation.php
Written By
Dr. Thomas E. Hicks
<!-- ================================================================ --> <!-- Display Users In The Table --> <!-- ================================================================ --> <font face="System" size="3" color="#FFFFFF"> <TABLE BORDER = "5" CELLPADDING = "4" CELLSPACING = "4" STYLE = "border-collapse: collapse" BORDERCOLOR = "#800000" BGCOLOR = "#FFFFFF" WIDTH = "100%" ID = "UserTable"> |
Although it is not essential, we are going to display the information from the database in a traditional HTML table. The code above establishes the format for this table.
<!-- ================================================================ --> <!-- Title Bar Row --> <!-- ================================================================ --> <TR><TD ALIGN = "Right"> <CENTER> <font color="#000080">#</font></CENTER> </TD> <TD ALIGN = "Left" > <font color="#000080">Name</font> </TD> <TD ALIGN = "Right" > <CENTER> <font color="#000080">No</font></CENTER> </TD> <TD ALIGN = "Left" > <font color="#000080">Password</font> </TD> <TD ALIGN = "Center"> <font color="#000080">ID #</font> </TD> </TR> |
The HTML code above creates the following Table Title Bar in the first row of the table.
# |
Name | No |
Phone |
<?PHP
While (!$UsersRecordSet->EOF)
{
?>
|
If the query is successful, the record set will contain information returned from the server. The record set pointer initially points to the first record in the record set. This record set point can be moved through the record set.
We would like to display the information from the current record in a row of our table and then move this record set pointer to the next record. This process shall continue in a Do While loop until the end of file is reached.
The basic form for the PHP Do While
Loop is :
While [Condition]
{
...........
}
<!-- ================================================================ --> <!-- One Row Per Record --> <!-- ================================================================ --> <TR> <TD ALIGN = "Center"> <?PHP Print $Counter; ?> </TD> <TD ALIGN = "Left"> <?PHP Print $Name->Value; ?> </TD> <TD ALIGN = "Center"> <?PHP Print $No->Value; ?> </TD> <TD ALIGN = "Left"> <?PHP Print $Password->Value; ?> </TD> <TD ALIGN = "Center"> <?PHP Print $ID->Value; ?> </TD> </TR> |
All of the code from the block above dumps output into a single row of the HTML table. A Counter is displayed in the first column. The current record's Name is placed in the second column. The current record's No is placed in the third column. The current record's Password is placed in the fourth column. The current record's ID is placed in the fifth column.
<?PHP
$Counter = $Counter + 1;
$UsersRecordSet->MoveNext();
}
?>
<?TABLE>
|
Counter is simply a counter to
number the records; it is incremented each pass through the loop.
The record set pointer is moved to the next record.
The end of the loop transfers control back to the While statement and repeats the block of
code within the loop untill the condition is no longer true. This loop
terminates when the record set pointer reaches the end of file.
<?PHP #-------------------------------------------------------------------------- # Close & Terminate The Connections #-------------------------------------------------------------------------- $UsersRecordSet->Close(); $Conn->Close(); $UsersRecordSet = null; $Conn = null; |
Close the record set and the connection. Set both to null.
#-------------------------------------------------------------------------- # Terminate The Session #-------------------------------------------------------------------------- Session_UnSet(); Session_Destroy(); ?> |
Clear the session variables and close the session.
</TABLE> </BODY></HTML> |
The HTML code above simply ends the table, the body, and the document.
The complete code may be found below. A working model may be found at
<?PHP
#=========================================================================
#=========================================================================
#==== SearchSecurityUserByNameConfirmation.php ====
#=========================================================================
#==== ====
#==== Purpose : Transfer to page Error.php and report error if ====
#==== user does not enter the Sought Name. Transfer ====
#==== to page Error.php and report error if the ====
#==== search comes up empty. Display all users that ====
#==== match the search query. ====
#==== ====
#==== Written By : Dr. Thomas E. Hicks Date: 08/1/2003 ====
#=========================================================================
#=========================================================================
#--------------------------------------------------------------------------
# Include The Database Utilities
#--------------------------------------------------------------------------
Include('../adodb/adodb.inc.php');
#--------------------------------------------------------------------------
# This block of code starts a new session and clears any session
# variables. It shall make sure that the input boxes on this form
# are initially blank; session variables shall store a copy of the
# user responses in all input boxes so that they may be reloaded on
# the page in the event that the user must return back to this page
# because of invalid input. The PreviousPage variable shall
# enable the corresponding confirmation page to assure that it is
# only called from this page.
#--------------------------------------------------------------------------
If (!IsSet($NewSearchName))
{
Session_Start();
Session_UnSet();
$NewSearchName = "";
$PreviousPage = "SearchName1";
$SearchName = "";
Session_Register("NewSearchName");
Session_Register("PreviousPage");
}
Else
$SearchName = $_SESSION["NewSearchName"];
$_SESSION["PreviousPage"] = "SearchName1";
?>
#--------------------------------------------------------------------------
# May Only Enter This Page From SearchSecurityUserByName.php!
#--------------------------------------------------------------------------
If ($_SESSION["PreviousPage"] != "SearchName1" )
{
Print "<Script Language = 'JavaScript'> " .
"window.location = 'SearchSecurityUserByName1.php'</Script>";
Print " ";
Exit;
}
#--------------------------------------------------------------------------
# Declarations & Initializations
#--------------------------------------------------------------------------
$Counter = 1;
$SearchName = Trim($_REQUEST["SearchName"]);
$_SESSION["NewSearchName"] = Trim($_REQUEST["SearchName"]);
#--------------------------------------------------------------------------
# Make Sure That SearchName Is Not Blank!
#--------------------------------------------------------------------------
If (StrLen($SearchName) == 0)
{
$ErrorMessage = "The Sought Name May Not Be Blank!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
#--------------------------------------------------------------------------
# Access Database RealPath Connect To The Server
#--------------------------------------------------------------------------
#------------------------ Create A Connection Object ----------------------
$Conn = New COM("ADODB.Connection");
#------------------------------ Absolute Path -----------------------------
$ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .
RealPath("C:\Security.mdb");
#------------------------------ Relative Path -----------------------------
$ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" .
RealPath("../../../Security.mdb");
#--------------------------------- Connect --------------------------------
$Conn->Open($ConnStr);
#--------------------------------------------------------------------------
# Read All Of The User Names Into The RecordSet
#--------------------------------------------------------------------------
#--------------------------- Traditional SQL Query ------------------------
$UserSQL = " SELECT * " .
" FROM Users " .
" WHERE Name Like '%" . $SearchName . "%'" ;
#------------- Create A Record Set That Contains Results Of Query ---------
$UsersRecordSet = $Conn->Execute($UserSQL);
#------- If No Record Set Was Generated, Print Out The Error Message ------
If (!$UsersRecordSet)
{
$ErrorMessage = "System Error - Unable To Generate Record Set!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
#------- If There Are No Records In The Record Set, Display Message -------
If ($UsersRecordSet->EOF)
{
$ErrorMessage = "There Are No Records Matching This Sought Name!";
Session_Register("ErrorMessage");
Print "<script language = 'JavaScript'> " .
"window.location = 'Error.php'</Script>";
Print " ";
Exit;
}
#------------------ There Are Records To Display ---------------------------
$Name = $UsersRecordSet->Fields(0);
$No = $UsersRecordSet->Fields(1);
$Password = $UsersRecordSet->Fields(2);
$ID = $UsersRecordSet->Fields(3);
?>
<HTML><HEAD>
<TITLE>Dr. Thomas E. Hicks - SearchSecurityUserConfirmation.php </TITLE>
</HEAD>
<BODY TEXT = "#000000"
BGCOLOR = "#000000"
VLINK ="#000000"
ALINK ="#000000"
BACKGROUND ="Paper.jpg">
<CENTER>
<FONT FACE="Arial" SIZE="4"> SearchSecurityUserConfirmation.php <BR>
Written By<BR>
Dr. Thomas E. Hicks</font><P>
</CENTER>
<HR>
<!-- ================================================================ -->
<!-- Display Users In The Table -->
<!-- ================================================================ -->
<font face="System" size="3" color="#FFFFFF">
<TABLE BORDER = "5"
CELLPADDING = "4"
CELLSPACING = "4"
STYLE = "border-collapse: collapse"
BORDERCOLOR = "#800000"
BGCOLOR = "#FFFFFF"
WIDTH = "100%"
ID = "UserTable">
<!-- ================================================================ -->
<!-- Title Bar Row -->
<!-- ================================================================ -->
<TR><TD ALIGN = "Right">
<CENTER> <font color="#000080">#</font></CENTER> </TD>
<TD ALIGN = "Left" > <font color="#000080">Name</font> </TD>
<TD ALIGN = "Right" >
<CENTER> <font color="#000080">No</font></CENTER> </TD>
<TD ALIGN = "Left" > <font color="#000080">Password</font> </TD>
<TD ALIGN = "Center"> <font color="#000080">ID #</font> </TD>
</TR>
<?PHP
While (!$UsersRecordSet->EOF)
{
?>
<!-- ================================================================ -->
<!-- One Row Per Record -->
<!-- ================================================================ -->
<TR>
<TD ALIGN = "Center"> <?PHP Print $Counter; ?> </TD>
<TD ALIGN = "Left"> <?PHP Print $Name->Value; ?> </TD>
<TD ALIGN = "Center"> <?PHP Print $No->Value; ?> </TD>
<TD ALIGN = "Left"> <?PHP Print $Password->Value; ?> </TD>
<TD ALIGN = "Center"> <?PHP Print $ID->Value; ?> </TD>
</TR>
<?PHP
$Counter = $Counter + 1;
$UsersRecordSet->MoveNext();
}
?>
</TABLE>
<?PHP
#--------------------------------------------------------------------------
# Close & Terminate The Connections
#--------------------------------------------------------------------------
$UsersRecordSet->Close();
$Conn->Close();
$UsersRecordSet = null;
$Conn = null;
#-------------------------------------------------------------------------- # Terminate The Session #-------------------------------------------------------------------------- Session_UnSet(); Session_Destroy(); ?> </BODY></HTML> |
You can see the results below:

The complete code may be found below.
<?PHP
#====================================================================================
#====================================================================================
#==== DisplayError.asp ====
#==== ====
#==== Purpose : Display the global System variable ErrorMessage and provide the ====
#==== User with a button which will allow them to return to the ====
#==== original form two levels back in the history. ====
#==== ====
#==== Written By : Dr. Thomas E. Hicks ====
#====================================================================================
#====================================================================================
?>
<HTML><BODY BACKGROUND = "Paper.jpg">
<HR>
<CENTER><p Align="Center"><b><Font Size=+0 Color="#660033">
<br>
<?PHP
Print $ErrorMessage;
?>
</font></b>
<FORM METHOD="POST">
<INPUT TYPE = "BUTTON"
VALUE = " Click This Button To Go Back To Correct The Problem! "
STYLE = "BackGround=DarkGreen; Color=#FFFFFF ;Cursor=hand; ".
"Font-Family ='system';Font-Size=10pt"
OnClick = "history.go( -2 ); return true;">
</FORM>
<HR></CENTER></BODY></HTML>
|