News and Views
Saturday, February 21, 2009 9:35:18 AM
Community MX released its 3000th article the other day. It's hard to believe we have been at it for 6 years now releasing 2 articles every day. In celebration, we're having a contest that ends March 10th. Sign up to win an Adobe software title or other prize at http://www.communitymx.com/3000/. My most recent articles there are below:
|Conditional PHP: Using the Ternary Operator
|Description: There are many uses for conditional statements in programming. The basic principle of conditional programming is that you want to execute code based on a certain condition. The essence of conditional programming is executing code based on the condition being true, with an alternate piece of code being executed if the condition is not true. The article will explain the ternary operator, which creates if/else logic that is more concise than other methods.
|Using Table Aliases
|Description: When writing SQL statements, using the table names in the code is often necesary to avoid confusion in the database server. For example, if you have a Customers table with a customerid field, and an Orders table with a customerid field, if you are joining both tables, you will need to use the table name on the customerid field in order to differentiate between the two tables. This can turn your queries into much longer, hard to read statements -- especially if you are using proper naming conventions and your table names are long and descriptive.
Using a table alias in the code is a beneficial way to increase readability and performance. Readers of this article should understand basic SQL coding, including joins. It will apply to most databases (SQL Server, MySQL, Access, etc).
|Description: Most database systems support the use of subqueries. If you have never used them, don't know what they are, or are confused by joins, then this article is for you. I'll be using the Northwind sample database that is readily available for SQL Server and Access, and available as a download for MySQL from my site.
|Adding an Auto-Logout Feature - Part 1
|Adding an Auto-Logout Feature - Part 2
|Description: If you have a site that is built using one of the server technologies, like ASP, PHP, or ColdFusion, that has a login feature, chances are you also have a logout function. What happens when the user keeps the browser open and doesn't log out? Many times he will go back to the page and attempt to click on something, only to find out that he has to login again. For example, the user might fill in a complex form and walk away, only to come back to try to submit the form and be kicked out of the site.
|HTML/CSS Crash Primer
|Category: CSS, HTML
|Description: This article is intended as a re-introduction to HTML and CSS, and something I have used in the past to give to any new employees who may have had HTML experience, but exhibited some bad habits in actual coding. You may think HTML is simple and you may think you know all you need to know, but HTML is misused daily. Following are some basics to help correct some of the common problems.
|Creating a Formatted Unique ID in PHP
|Description: There are often times that you need a unique id in an application, but don't want to use an auto-incrementing integer. If an application is well designed and secure, an auto-incrementing number is usually fine, but to be on the safe side a unique identifier other than an integer is better as an id. For example, a customer number is a good use of a unique identifier, or an order number.
|Blank Pages in PHP
|Description: If you are a PHP developer, you are likely familiar with the blank page -- an error page with no error message. PHP has some default settings that prevent any error messages from appearing when you install PHP and do not adjust the error display settings. This article will show how to show your error messages.
|Creating MySQL Logins for a Web Site
|Category: PHP, SQL
|Description: MySQL is a popular database to use for your web site, allowing the power of a server-based database management system to be used for free. With the added power comes added danger-MySQL is frequently targeted by hackers. My article on preventing SQL injection attacks mentioned database login security briefly.
In this article, I will expand on how to actually create users for your web site, which is vital knowledge when you are acting as a database administrator. If you have a PHP site using MySQL and you don't have a database administrator-you are it.
|Creating SQL Server Logins for a Web Site
|Description: SQL Server is a popular database to use for your web site, especially since the Express version has been released, allowing the power of SQL Server to be used for free, making it a much more viable solution than some of the other free databases out there, like MySQL. With the added power comes added danger -- SQL Server is frequently targeted by hackers. My article on preventing SQL injection attacks mentioned database login security briefly. In this article, I will expand on how to actually create users for your web site.
Before posting comments or trackbacks, please read the posting policy.