Articles by Gerald Hanks

Gerald Hanks has been involved in web development applications since 1996. He has designed applications with JavaScript, ASP.NET and PHP, as well as building databases in MS SQL Server and MySQL. He lives in Houston, Texas.

PHP Ad Tracker: Entering Ad Banner and Client Data

In our last session, we showed how to list the ad banner data and client data.  In this session, we will examine the form that allows administrators to enter ad banner data. First, we include the class_ads.php file and instantiate the ads class: <?php require_once("class.ads.php"); // instantiate ads class $oAds = new ads; Next, we assign a value for the $id variable by suing the setID function in the ads class: // check for id if ($id) { // assign unique id $oAds->setId($id); } If the form has posted...

PHP Ad Tracker: Site Administration Ad Banner Data Form

If you have read any of the other posts in this series you know that we have done quite a bit with our PHP ad tracker. In this session, we will look at the HTML form that calls these actions. First, we create the HTML table that will hold the form header: <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><b>Developer Drive Advertisements Administration</b></td> </tr> Next, we specify the operation (add/edit/delete/deactivate) for this...

PHP Ad Tracker: Listing Ad Banners and Clients

In our last session, we finished writing the PHP class file that would control all the ad banner functions.  This week, we look at the presentation layer for the administration of these functions. The ads_list.php page lists the current banner ads.  First, we must include the class file so that the page can instantiate the class call the functions: <?php require_once("class.ads.php"); // instantiate ads class $oAds = new ads; Next, we fill the $aAds array with the data from the ads table and get...

PHP Ad Tracker Part III: Data Object Coding

In last week’s lesson, we looked at the variables and methods we would need to interact with the advertising database tables. This week, we’ll examine the code for the data object class file and how the other parts of the site will use these methods. First, we include the database connection string information.  This information includes the database server name, cursor location and other pertinent information. Since this information is used throughout the site, it is usually stored in a separate...

PHP Ad Tracker: Reports and Records

In the previous lesson, we examined the basic functions of our banner ad tracking system, including the retrieval of records for both banner ads and advertisers. In this lesson, we will look at the functions responsible for generating reports and manipulating the data in the ads table and advertiser table. The getClientsList() function retrieves active client records and sorts them alphabetically by client name: function getClientsList() { // get clients from db $sql = "SELECT ad_client_id,...

PHP Ad Tracker Part IV: Displaying and Linking Ads

In our last session, we looked at the process of entering information on ad banners and ad clients, as well as generating ad activity reports. This week, we examine how to retrieve a random banner ad. We will also learn how to delete, activate and deactivate ads and clients. The getRandomAd() function retrieves a random ad by using the PHP rand() function. The function returns the ad’s primary key ID, client ID, title, URL and redirect path. The function also updates the activity table for this banner...

PHP Ad Tracker: Data Object Design and Coding

In our last PHP Ad Tracker lesson, we constructed the database tables for our ad banner application. Now we are ready to construct the data object that will hold the variables and functions that will display, add, edit and delete the data in those tables. Once we name all of the variables and functions, we will start applying the code to them. Variables: The data object class will hold two variables: one to hold the banner ad ID number from the ads table, and one to hold the database connection information....

PHP Arrays: Array Functions and Multidimensional Arrays

In Part I, we looked at simple arrays, as well as how to loop through and sort array elements.  In this article, we will look at other array functions as well as multidimensional arrays. The difference between one-dimensional and multidimensional arrays is a simple one: a multidimensional array is a simple array that has simple arrays as elements, rather than strings or scalar variables. Building a Multidimensional Array ... Here is how our $arrBooks example from last week’s article can be expanded...
Load more
Home CSS Deals DesignBombs HTML HTML5 JavaScript jQuery Miscellaneous Mobile MySQL News PHP Resources Security Snippet Tools Tutorial Web Development Web Services WordPress