really strange mysql result

Discussion in 'Perl Misc' started by Alexandre Jaquet, Mar 14, 2005.

  1. Hi,

    I can't understand why I got different result
    with the same sql query.

    My code :

    sub getComboBox {

    my $name = shift || '';
    my $htmlbuffer = '';
    my @members = ();
    my $group = ();

    (@members) = sqlSelect("clientlevel","user","userID=userID AND
    clientlevel <> ''");

    $htmlbuffer = "<select name=\"$name\" style=\"width: 100%\"
    class=\"editionFld\" \">\n";

    foreach $group(@members) {
    $htmlbuffer.= "<option value=\"$group\" selected>$group</option>\n";
    }
    return $htmlbuffer .= "</select>\n";
    }

    I got only one result and when I execute the query with the console :
    select clientlevel from user where userID=userID and clientlevel <> ''

    I got 4 items
    Alexandre Jaquet, Mar 14, 2005
    #1
    1. Advertising

  2. In article <d142l3$3o8$>,
    Alexandre Jaquet <> wrote:
    :I can't understand why I got different result
    :with the same sql query.
    :(@members) = sqlSelect("clientlevel","user","userID=userID AND
    :clientlevel <> ''");

    Do you really want to be passing in the literal string userID as the userID ?
    Has the variable userID previously been set by the code ?
    --
    'ignorandus (Latin): "deserving not to be known"'
    -- Journal of Self-Referentialism
    Walter Roberson, Mar 14, 2005
    #2
    1. Advertising

  3. Walter Roberson a écrit :
    > In article <d142l3$3o8$>,
    > Alexandre Jaquet <> wrote:
    > :I can't understand why I got different result
    > :with the same sql query.
    > :(@members) = sqlSelect("clientlevel","user","userID=userID AND
    > :clientlevel <> ''");
    >
    > Do you really want to be passing in the literal string userID as the userID ?
    > Has the variable userID previously been set by the code ?


    Nope I don't really need that, I was just been trying different form.
    Alexandre Jaquet, Mar 14, 2005
    #3
  4. Alexandre Jaquet a écrit :
    > Walter Roberson a écrit :
    >
    >> In article <d142l3$3o8$>,
    >> Alexandre Jaquet <> wrote:
    >> :I can't understand why I got different result
    >> :with the same sql query.
    >> :(@members) = sqlSelect("clientlevel","user","userID=userID AND
    >> :clientlevel <> ''");
    >>
    >> Do you really want to be passing in the literal string userID as the
    >> userID ?
    >> Has the variable userID previously been set by the code ?

    >
    >
    > Nope I don't really need that, I was just been trying different form.


    I'm getting headache if I debug the query who's past to the sqlSelect I
    got : sql : SELECT clientlevel FROM user WHERE userID=userID AND
    clientlevel <> ''

    just the same :s
    Alexandre Jaquet, Mar 14, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amir
    Replies:
    3
    Views:
    576
  2. nc
    Replies:
    1
    Views:
    474
    nice.guy.nige
    Feb 3, 2005
  3. Replies:
    2
    Views:
    320
  4. Michael Tan
    Replies:
    32
    Views:
    907
    Ara.T.Howard
    Jul 21, 2005
  5. Andy Tolle
    Replies:
    7
    Views:
    217
    Andy Tolle
    Nov 15, 2010
Loading...

Share This Page