SHARE
Facebook X Pinterest WhatsApp

dotcomma: Efficient SQL in PHP

Written By
thumbnail
Web Webster
Web Webster
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.”

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

Complete
Story

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

Red Hat reveals major enhancements to Red Hat Enterprise Linux AI
sjvn
Oct 22, 2024
How to Find AWS EC2 Instance Type Over SSH (6 Methods)
Benny Lanco
Sep 23, 2024
Crond: Daemon to Execute Scheduled Commands
Rose Hosting Blog
Sep 20, 2024
A Detailed Introduction to Oracle VirtualBox
Senthil Kumar
Sep 19, 2024
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.