Are you sure that you're enclosing your SELECT statement in the right quote and double-quote combination?  I use Perl with mySQL a lot--that's almost all that I do, actually--and I can make mySQL look for a blank field without changing the column or table settings.  Below is an excerpt from one of my scripts.  I modified an existing working script to look for a blank (that is to say '') within one of my tables just to see if it would work, and it did.

$dbh_ship = DBI->connect("DBI:mysql:db_name:localhost", "user", "passwd", \%attr ) || die "Could not connect to database: " . DBI->errstr; $sql_str_ship = "SELECT * FROM shipping WHERE street1='' ORDER BY ship +_id"; $sth_ship = $dbh_ship->prepare($sql_str_ship); $sth_ship->execute(); while (@shipping = $sth_ship->fetchrow_array()) { # and so forth....

In this example I'm looking for records in my shipping table that are missing the street address.  The column parameters read YES in the null column and NULL in the default column.  Again, I think you must be missing something very minor.

That's Spenser, with an "s" like the detective.


In reply to Re: mysql search statement by Spenser
in thread mysql search statement by Parham

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.