Entries tagged "Web Development"

Avoid Overly Complicated Code by Stopping Scripts Early

The if construct is commonly used within PHP. It lets us execute blocks of code based on certain condition(s) being met. We can even layer if constructs within if constructs to perform operations that are very specific to the task at hand. While this gives us greater control over how the overall script executes, there may be cases where piling on the if constructs can lead to unnecessary complications. [Continue reading]

Understanding How the Modulus Operator Works

I've used the modulus operator in PHP for a while, but I didn't truly understand how it works. Now, I know how to divide. I also know that the modulus operator returns the remainder when one number is divided by another. However, my calculation just didn't match the returned result. So let's look at where I went wrong. [Continue reading]

Build HTML Tables Dynamically with PHP Part 3: CSS Alternative

Using HTML tables for design is typically frowned upon in the Web community and the last two posts talked about using tables to display pictures and names in rows of three. For those unfamiliar with the CSS alternative, I didn't want to leave you hanging. So let's look into solving our problem with CSS. [Continue reading]

Build HTML Tables Dynamically with PHP Part 2: Simplify with array_chunk()

Last week we built an HTML table on the fly using PHP. The process required a counter for monitoring which column was being displayed and some tests to determine when to add row tags. Let's look into simplifying the process with a built-in PHP function called array_chunk(). [Continue reading]

Build HTML Tables Dynamically with PHP Part 1

There is a built-in PHP function which would have really been useful back when using HTML tables for design was popular. Instead of setting up counters and testing when to add the opening and closing tags, we could have just read in the data and displayed it. Let's pretend we're back in the heyday of table hacking and look how the function saves time. [Continue reading]

Using phpMyAdmin as a Checklist for Columns Used in a Script

One of my many coding habits I've been changing is the use of select all (SELECT *) in MySQL queries. Scripts usually don't need all the columns and grabbing unnecessary data reduces efficiency. Fixing the references usually involves me digging through the code, remembering the column names actually being used, and updating the query. This method works well when there are only a few columns to worry about. It gets more complicated with more columns or when they're used throughout a large script. That's where phpMyAdmin comes to the rescue. [Continue reading]

Simplify Website Experiments by Creating Test Folders

While experimenting with new website features, I'm not always consistent with managing the files. I usually duplicate the file being updated, but sometimes I edit the original while other times I modify the duplicate. This normally isn't a problem since most projects are completed relatively quickly. However, there are times when a project is placed on hold. Depending on how long I'm away, it can be difficult determining which file to edit when returning. So let's talk about ways to differentiate the files. [Continue reading]

Populate Forms Which Have Been Disconnected from Google Docs

Due to popular demand, we're going to look at pre-populating Google forms using PHP. Last week's post showed how forms can be liberated from Google Docs. Since they're disconnected, we won't be able to depend on the standard method provided by Google. We're responsible for developing our own solution. Luckily, this is fairly straight forward with server-side languages like PHP. [Continue reading]

Disconnect Forms from Google Docs for Complete Customization

Google forms provide a quick, easy, and free way to collect information from customers. The forms can even be embedded within an existing website to give a more consistent look from one page to another. Unfortunately, Google doesn't supply very many options for customizing forms. There is a way around these limitations, however. [Continue reading]

Fix for Download Issue with PDFs and Internet Explorer

Over the past few months, comments have been coming in about PDFs not opening properly. The process seems to get stuck before the download completes. However, the issue doesn't always manifest. There seems to be a correlation between it and larger PDF files. After a bit of research and eliminating some possible contributing factors, I came across a solution which worked for me. [Continue reading]