Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:10:24+00:00 2026-05-30T22:10:24+00:00

$sql = ‘SELECT * FROM `phpbb_profile_fields_data`’; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) {

  • 0
$sql = 'SELECT * FROM `phpbb_profile_fields_data`';

$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result)) {      
    if ($row['pf_kp_em_no_bonethr'] == '1') {
        echo " Was 1";
    } else if ($row['pf_kp_em_no_bonethr'] == '2') {
        echo "Was 2";
    } else {
        echo "Was Neither 1 or 2";
    }
}

$db->sql_freeresult($result);

I am curios, In my example I am checking the field for either a value of 1 or 2 but how do I check it for a value of NULL. Would it be any of the following three:

if ($row['pf_kp_em_no_bonethr'] == '')
if ($row['pf_kp_em_no_bonethr'] == '-1')
if ($row['pf_kp_em_no_bonethr'] == 'NULL')

Normally I would just try it out but I am not at home and wont be for the foreseeable future it has been bugging me. I am pretty sure it’s not the second but I have seen -1 used for a null value in other languages. So can someone verify how I would indeed check for a NULL value please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:10:26+00:00Added an answer on May 30, 2026 at 10:10 pm

    Something like this should work.

    if (is_null($row['pf_kp_em_no_bonethr'])) {
      echo "Is NULL";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL: SELECT u.id, u.name, isnull(MAX(h.dateCol), '1900-01-01') dateColWithDefault FROM universe u LEFT JOIN history h
SQL Server 2005 query is as follows...... SELECT ClgId FROM IdMaker_DB WHERE Course =
SQL query: select ApplicationNumber,pri_indicator,count(*) from customer group by ApplicationNumber,pri_indicator How do I do this
SQL 2008 : I have created a View ( select * from VW_Test1 ).
SQL: SELECT COUNT(*) FROM bb_posts post LEFT JOIN bb_topics topic ON topic.topic_id = post.topic_id
SQL 1: select * from t1 join t2 on t1.f1 = t2.f2 SQL 2:
SQL: SELECT uFName, uLName, listTitle, listPropPrice, listCmt, listDt, mFName, mLName, moAmt, moDtOff FROM User
SQL Server 2000 I backup a table like below: select * into bkp_table from
SQL Server 2000 Standard, Windows 2003 My coworker removed 'BUILTIN\Administrators' group from SQL Server
SQL Server (2005/2008) Each of the below statements have the same result. Does anyone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.