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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |