cfqueryparam and the null attribute

Sometimes its necessary to insert a null value into a column in a database. For example if the length of a string is blank, you may prefer null rather than a blank entry. Here is one way to achieve this without cfqueryparam: Here is another way with the cfqueryparam tag Both are a bit messy […]

Sometimes its necessary to insert a null value into a column in a database. For example if the length of a string is blank, you may prefer null rather than a blank entry. Here is one way to achieve this without cfqueryparam:

Here is another way with the cfqueryparam tag

Both are a bit messy right? Well how about we get these into one nice, tidy bit of code. This is where the null attribute of cfqueryparam comes in:

This simply says, give me a yes if the length of string Intro is 0. This then makes the query insert a null.

Duncan Isaksen-Loxton

Educated as a web developer, with over 20 years of internet based work and experience, Duncan is a Google Workspace Certified Collaboration Engineer and a WordPress expert.
Login
Log in below to access your courses.
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.