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.

Building a PHP Ad Tracker: Creating the Database Tables

For the vast majority of modern websites, advertising is a major source of revenue. Banner ads for services related to the web site owner’s industry allow customers to view products that tie into the site owner’s core business. In exchange, the web site owner can charge the banner ad owner for every impression (banner ad appearance) or click-through (when a user clicks the banner ad). In order to build a banner ad management system, we must first create the database tables that will hold the ad information,...

PHP Arrays: Defining, Looping and Sorting Simple Arrays

Unlike scalar variables, which assign only a single value to a variable, an array variable can hold multiple values. Arrays are useful for holding values from database queries or web form entries, where each field (also called a “key”) holds a specific value. Let's take a look at how we define some of the arrays we use in PHP.Numbered Arrays. If the programmer does not specify a key for each value in the array, PHP automatically numbers the keys, starting from zero. This code defines an array $arrMonths[],...
C#

Common C# Build-Time Errors Part II: Inheritance and Interfaces

In our last lesson, we saw many of the most basic build-time errors in C#. In this session, we will look at some of the errors related to: classes subclasses inheritance Once we address some of the more common errors we will take a look at how you can fix them. #1 Hidden Method Name Creates Overload ... This conflict arises when a base class and its subclass have a function of the same name public class MyBaseClass { public void Function() { // function code goes here } { public class MySubClass : MyBaseClass...
C#

Common C# Build-Time Errors: Part I

Here’s the situation: You’ve written a program in C#. You’ve checked the flowcharts, examined your coding and developed your user interface. You’re anticipating that everything will flow as smooth as silk. You’re ready to create a build of the program and, instead of seeing a beautiful, efficient result, you get several (often incomprehensible) error message. How did this happen? Here are SOME ways that these errors occur: #1 Undeclared Variables ... C# throws an error message on undeclared...
PHP

PHP User Survey Part V: Administration Layer

In the last piece on our PHP online user poll, we look at the administrative service and how the site supervisor enters, deletes and manages the poll data. The first poll administrative page checks if the administrator is logged in. You can choose from Session variables or Cookies to check the site administrator login status. Once the application has confirmed the identity of the site administrator, the page lists the available polls. The first step is to use the class methods and variables in the class.polls.php...
PHP

PHP User Survey Part IV: Presentation Layer

So far in this series, we have developed the data layer (database tables) and the business layer (PHP methods) for manipulating the data. In this piece, we will look at the presentation layer that is used to display the poll question and poll results. The HTML header will check for the presence of a cookie (in case the user has voted previously) and refresh the page if it has timed out. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
PHP

PHP User Survey: Setting Variable Values and Reading from Tables

In Part I of this series, we started the process of creating user polls for a business web site. Part I gave the layout of the data layer and began the construction of the class file.  In this part we will continue with adding methods to the class file that will enable the administrator to set the variable values and read from the database tables. The setPollId($iPollId) method sets the value for the _iPollId variable.  Since the constructor method calls the setPollId($iPollId) method, we must...

Creating a PHP User Survey: Writing to Database Tables

In the first two parts of this series, we created the data layer that will hold the polling data and established methods for setting the variable values and reading from the database tables. In this part, we will build the methods that will write new polls and answers to the tables. The addPoll method adds a new record to the devdrive_polls table and returns a Boolean value that signals if the record was added successfully. function addPoll($aArgs) { // add a poll record $sql = "LOCK TABLES devdrive_polls...
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