A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Waterfall_Cache has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 47

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 194

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Memcache_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 275

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Filesystem_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 440

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; APC_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 628

dotcomma: Efficient SQL in PHP

dotcomma: Efficient SQL in PHP

By ServerWatch Staff (Send Email)
Posted Jun 11, 2000


[ Thanks to Adam Berlinsky-Schine for this link. ]

"There are many articles that will tell you how to connect to a database with PHP, perform simple queries and work with the results. This article will not cover those basics. The purpose of this article is to cover some of the less obvious things that can be done when working with SQL, and how to utilize them with PHP. SQL is a very powerful language and can do many things if used correctly and efficiently." The purpose of this article is to cover some of the less obvious things that can be done when working with SQL, and how to utilize them with PHP.

"I will be using MySQL as the database for this article, simply because more beginning PHP programmers use it than any other database. The first database I used with PHP was PostgreSQL, and most if not all of these examples will work with it simply by calling the equivalent PostgreSQL functions. For a working example of PostgreSQL functions, see the Assembly Coder's Zenith website. The footer on every page of the main site has a link to view the source code of the page (shameless plug, I know)."

"Good coding practices and standards will save you many hours in both development time and in debugging. This cannot be emphasized enough. Many times while programming I will end up writing the same few lines of code over and over. When I realize this, I will write a function to handle it and change all the code into function calls. Sure, it takes a few minutes, but then the next time the code is needed, a mere function call is all that it takes. And the code is easier to read. If you find yourself doing a lot of copy/paste coding, consider using a function call. When you are done with a project you will likely have many functions written. You will be able to move many of these into a shared include file. Instead of writing new code on your next project, you will be able to use the already functions immediately. Another reason using a function is important is that it allows you to do more error checking than might normally be done."

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.


 

 


Thanks for your registration, follow us on our social networks to keep up-to-date