Jump to content

[SOLVED] If row NULL in query ignore?


SEVIZ

Recommended Posts

This should be working.  Its something I actually had tried before but the option still shows.  Here is my full code in case its needed for something else I am missing.

 

<?php 

$q = "SELECT `sup` FROM `sprint` WHERE `sup` IS NOT NULL GROUP BY `sup`";
$ret = mysql_query($q);

while ($row = mysql_fetch_assoc($ret)) {
    $email_sec = $row['sup'];
    print "<option value=\"$email_sec\">Team $email_sec</option>";
}
?>

Link to comment
Share on other sites

how did those rows in `sup` get to be null in the first place?  do you have it set as the default and when you insert a new row, leave that column blank?  when you insert a new row, are you doing null or 'null' if you are putting something?

 

point I'm trying to make is, maybe it's not really NULL but is storing a string of value "NULL" or an empty string "" (which is not the same as null), due to however you have your db or code setup.

Link to comment
Share on other sites

how did those rows in `sup` get to be null in the first place?  do you have it set as the default and when you insert a new row, leave that column blank?  when you insert a new row, are you doing null or 'null' if you are putting something?

 

There are only two items that are empty in this spot.  I imported all the data from an excel sheet originally.  In phpmyadmin this is set as "not null" with no default set if that matters.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.