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

  • Home
  • SEARCH
  • 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 6090143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:10:49+00:00 2026-05-23T12:10:49+00:00

I have 5 fields in my DB: test1 = 1, test2 = 1, test3

  • 0

I have 5 fields in my DB:

test1 = 1, test2 = 1, test3 = NULL, test4 = NULL, test5 = NULL

PHP code:

if(isset($result['test1'])){$test1= "Test1"; echo $test1};

if(isset($result['test2'])){$test2= "Test2"; echo $test2};

if(isset($result['test3'])){$test3= "Test3"; echo $test3};

if(isset($result['test4'])){$test4= "Test4"; echo $test4};

if(isset($result['test5'])){$test5= "Test5"; echo $test5};

$total = implode(", ", array_filter(array($test1, $test2, $test3, $test4, $test5)));

echo $total;

Finaly Output:

Undefined Variable test3 in Line 7

Undefined Variable test4 in Line 7

Undefined Variable test5 in Line 7

Test1, Test2

I came up with 3 possible ways to hopefully run the code with NULL values to see if I will get a blank page with no error, unfortunately, they all gave me “Underfined Variable” error:

  1. if(isset($result['test3'])){$test3= "OK"; echo $test3};

  2. if(!empty($result['test3'])){$test3= "OK"; echo $test3};

  3. if($result['test3']=='1'){$test3= "OK"; echo $test3};

Help? Thanks in Advance!

  • 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-23T12:10:50+00:00Added an answer on May 23, 2026 at 12:10 pm
    if(isset($result['test1'])){$test1= "Test1"; echo $test1} else { $test1="Abrakadabra"; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following databases: test table1 fields: id, password, name, lastname test2 table2 fields:
I have the following PHP code, which is meant to insert data in the
I have this snippet of code (AJAX) in jQuery. $.get('someScript.php?lat=' + clickedLatLng.lat() + '&lon='
How do I lock mysql tables in php? I currently have this code: $db->query(LOCK
I have a coworker who writes unit tests for objects which fill their fields
In my database we have fields where the data is not readable. I now
In SQL its possible to have fields that cannot contain duplicate data. How is
When designing user table what would be the must have fields from the security/user
I am learning Java and just found that the Interface can have fields, which
I have 2 fields in the database month (numeric) and year (numeric) and I

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.