Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: Duplicity Check Help!

by Anonymous Monk
on Dec 02, 2010 at 16:47 UTC ( #874943=note: print w/replies, xml ) Need Help??

in reply to Re^3: Duplicity Check Help!
in thread Duplicity Check Help!

It makes sense what you said, but the issue is on these lines
if(($row->{image_name_1} ne "") eq ($pics[0] ne "")){$flag_pic ++=1;} if(($row->{image_name_2} ne "") eq ($pics[1] ne "")){$flag_pic ++=1;} if(($row->{image_name_3} ne "") eq ($pics[2] ne "")){$flag_pic ++=1;} if(($row->{image_name_4} ne "") eq ($pics[3] ne "")){$flag_pic ++=1;}
It is not considering the equality, even if the images are not a match it is still incrementing $flag_pic+=1.

Replies are listed 'Best First'.
Re^5: Duplicity Check Help!
by wallisds (Beadle) on Dec 02, 2010 at 17:26 UTC

    Oh. I'm sorry. I see what you mean. If flag_pic is incremented every time, do me a favor and run this:

    if(($row->{image_name_1} ne "") eq ($pics[0] ne "")){ print "IMG NAME is '$image_name_1'\n"; print "PICS-0 is '$pics[0]'\n"; $flag_pic+=1; }

    This will help in troubleshooting because I am not sure what values to expect for these two variables. Right now you are checking to see:
    1. if the image name is not equal to '' (empty string)
    2. if the pic is not equal to '' (empty string)
    Am I correct in my understanding that $pic[x] #(where x is 0-3) will not usually be an empty string because it's the file the user is trying to upload?
    Maybe you want to change your if to evaluate against the image name compared to the picture name?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://874943]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2023-03-27 20:52 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (66 votes). Check out past polls.