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 8685803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:40:09+00:00 2026-06-12T22:40:09+00:00

I know this is very simple, but I haven’t used PHP/MySQL in a while

  • 0

I know this is very simple, but I haven’t used PHP/MySQL in a while and I have been reading other threads/php website and can’t seem to get it.

How can I query a single row from a MySQL Table and print out all of the fields that have data in them? I need to exclude the NULL fields, and only add those that have data to an html list.

To clarify, I would like to display the field data without specifying the field names, just for the reason that I have a lot of fields and will not know which ones will be NULL or not.

  • 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-06-12T22:40:11+00:00Added an answer on June 12, 2026 at 10:40 pm

    What you’ve outlined requires 4 basic steps:

    1. Connect to the database.
    2. Query for a specific row.
    3. Remove the null values from the result.
    4. Create the html.

    Step 1 is quite environment specific, so that we can safely skip here.

    Step 2 – SQL

    SELECT * from <tablename> WHERE <condition isolating single row>
    

    Step 3 – PHP (assuming that $query represents the executed db query)

    //convert the result to an array
    $result_array = mysql_fetch_array($query);
    
    //remove null values from the result array
    $result_array = array_filter($result_array, 'strlen');
    

    Step 4 – PHP

    foreach ($result_array as $key => $value)
    {
        echo $value \n;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is very simple, but I haven't been able to figure it out yet.
I know this is probably a very simple question but how would I do
This may be very simple question,But please help me. i wanted to know what
I know it might be a very simple solution for this, but I am
I know this might be very easy to some,, I have a simple string
I know this is very similar to a few other questions, but I can't
This is a very simple question, but I haven't seem to be able to
This question might appear very simple, but i haven't found an answer yet, so
I imagine this is pretty dead-simple, but somehow I haven’t been able to get
I know this question has been asked but I haven't found any satisfactory answers.

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.