CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Mysql IFNULL NOT working in PERL

 



Demerzel
Novice

Jun 14, 2011, 2:28 AM

Post #1 of 1 (409 views)
Mysql IFNULL NOT working in PERL Can't Post

I have a problem with IFFNULL for SQL statement. Directly in MySQL it works fine. In Perl, it always return 1,

Code
my $sdbq = $dbase->prepare("SELECT IFNULL((SELECT id FROM nodes WHERE ownerid=?),0)"); 
my $var =$sdbq->execute($row->{'id'});
print "ID:".$row->{'id'}."node:".$var."\n ";

Even when I change ? to number it shows 1. Eaven if in MySQL it shows 0

Code
mysql>  SELECT IFNULL((SELECT id FROM nodes WHERE ownerid=1),0);

-works fine "0".

Code
my $sdbq = $dbase->prepare("SELECT IFNULL((SELECT id FROM nodes WHERE ownerid=1),0)"); 
my $var =$sdbq->execute();

- "1"?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives