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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:10:17+00:00 2026-05-20T18:10:17+00:00

This script here by GeekFish can get you empty/null fields in a table. It

  • 0

This script here by GeekFish can get you empty/null fields in a table. It however outputs the results in an array format and repeats itself. Eg. Array ( [0] => Field “5” on entry “1” is empty/null [1] => Field “price” on entry “1” is empty/null. I only need the results in the odd number arrays [1],[3],[5].. and print them to a modal form. Thanks.

$sql = "SELECT * FROM TABLE_PRODUCTS";
  $res = mysql_query($sql);
   $emptyFields = array();
 while ($row = mysql_fetch_array($res)) {
  foreach($row as $key => $field) {
    if(empty($field)) {
   $emptyFields[] = sprintf('Field "%s" on entry "%d" is empty/null', $key,    $row['table_primary_key']);
    }
 }
}print_r($emptyFields);
  • 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-20T18:10:17+00:00Added an answer on May 20, 2026 at 6:10 pm

    Thats not really a good script, why not only return data that has fields that are empty or null in the SQL statement?

    Also, what do you mean by only odd rows? do you mean you want to skip every other row? if so this ‘should’ work:

       <?php
        $sql = "SELECT * FROM TABLE_PRODUCTS";
          $res = mysql_query($sql);
           $emptyFields = array();
         $row_count=1;
         while ($row = mysql_fetch_array($res)) {
          if(($count%2) != 0) {
            foreach($row as $key => $field) {
              if(empty($field)) {
                $emptyFields[] = sprintf('Field "%s" on entry "%d" is empty/null', $key,  $row['table_primary_key']);
              }
           }
           $row_count++;
         }
        }print_r($emptyFields);
    

    let me know if you meant something else

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone here had some experience writing this type of script
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I took this script from here : import csv from itertools import izip f
well im using this script right here: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/ and I have a multiMonth plugin
I got this script from here $(document).ready(function() { $('#choose').change(function(event) { $.post('select-ajax.php', { selected: $('#choose').val()
I wrote this sh script here. What it suppose to be doing is it
Any reason as to why this script won't work in any other browser. HERE'S
<!--[if IE]> // load script here <![endif]--> this script i written inside this hack
I have a problem with this script : click here . Currently it's working
i was wondering if anyone can tell me how to make this script work.

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.