SQL posts

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...

MySQL – Deletion History Part 1

MySQL stored procedure's come in really handy at times. I like to let the database do the work for me sometimes. For example, in an e-commerce system you may need to calculate a tax. For our example today though, we will use the tables we made in my previous article on the XREF table. We are going to focus this tutorial on getting the appropriate tables in place to preform our history logging. To start, we are going to create a module's table so that our history table can be one table instead of many and we are...

The XREF table for MySQL

The XREF, or cross reference table, is a database table that links records together. These tables are very good for normalization in your database. I almost always use an xref when I need an many to many relationship. Usually XREF tables have only two columns with no Primary Key. That's right, the two columns together make them unique. They are both Foreign Keys to other tables. A real life example of this would be in any standard CRM. Let's go over this example right now. Many CRM's could have a table to store...

Creating a PHP User Survey: Database Tables and Class File Constructor

User surveys can be an extremely effective marketing tool for any business web site. Visitors can make their voices heard on what products, services and information they would like the site to provide. Site owners can then adjust their marketing plans and promotions around the results of these polls. In order to build a basic user poll, we must first create the database tables that will hold the poll question and its various responses. Create the MySQL Polls Table ... First, we must build a database table...

How to Prevent a SQL Injection Attack

A SQL injection is a common programming error the consequences of which can be really devastating. Many successful hacking attacks start when a hacker discovers a vulnerability that gives an opportunity to inject SQL code. When an SQL injection occurs, the structure of an SQL query is compromised and as a result you are left at the mercy of the potential hackers. If there is a vulnerability found, hackers can exploit it to gain access not only to your site and database but in extreme cases also to your corporate...
Home CSS Deals DesignBombs HTML HTML5 JavaScript jQuery Miscellaneous Mobile MySQL News PHP Resources Security Snippet Tools Tutorial Web Development Web Services WordPress