Query Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • daksport00@gmail.com

    Query Problem

    Im not sure if Im posting this in the proper Group, if not, please
    direct me to the correct place.

    I am working on a website for a gaming league/ladder. I have one
    particular line of code that is giving me a hell of an issue.


    $mbrguid = (mysql_query(SE LECT guid FROM users WHERE id='$inviteid'" )
    if (is_null($mrbgu id)){go into error page}


    The table Users has a text field GUID which defaults to a Null. Id is
    a numberic player ID which is typed in by the end-user.


    All of my SQL knowledge tells me that this code should pull the GUID
    field form the Users table based on the ID.


    The problem I am having is that when I echo the $mrbguid variable, it
    return a value of "Resource ID #19". This value doesn't appear in the
    Users table anywhere, let alone in ANY table.


    Any suggestions as to what is causing this error, or perhaps a way to
    work around this code.


    What I am looking to do, is pull the GUID field form the table. If it
    is a null or blank value, throw the program into error.


    Yes, I know that Null and Blank(empty) are not the same thing, but I
    can change the table setup to suit the easier variant.


    Thanks


    -Dave

  • Andy Hassall

    #2
    Re: Query Problem

    On 26 Jun 2006 12:31:59 -0700, daksport00@gmai l.com wrote:
    [color=blue]
    >$mbrguid = (mysql_query(SE LECT guid FROM users WHERE id='$inviteid'" )
    >if (is_null($mrbgu id)){go into error page}
    >
    >The problem I am having is that when I echo the $mrbguid variable, it
    >return a value of "Resource ID #19". This value doesn't appear in the
    >Users table anywhere, let alone in ANY table.[/color]

    This is how mysql_query works, it returns a result set resource.



    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Geoff Berrow

      #3
      Re: Query Problem

      Message-ID: <1151350319.546 164.145600@i40g 2000cwc.googleg roups.com> from
      daksport00@gmai l.com contained the following:
      [color=blue]
      >$mbrguid = (mysql_query(SE LECT guid FROM users WHERE id='$inviteid'" )
      >if (is_null($mrbgu id)){go into error page}
      >
      >
      >The table Users has a text field GUID which defaults to a Null. Id is
      >a numberic player ID which is typed in by the end-user.
      >
      >
      >All of my SQL knowledge tells me that this code should pull the GUID
      >field form the Users table based on the ID.[/color]


      $result = mysql_query("SE LECT guid FROM users WHERE id='$inviteid'" );
      $mbrguid=mysql_ fetch_array($re sult);
      if (is_null($mrbgu id['guid'])){go into error page}

      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Alvaro G. Vicario

        #4
        Re: Query Problem

        *** daksport00@gmai l.com escribió/wrote (26 Jun 2006 12:31:59 -0700):[color=blue]
        > $mbrguid = (mysql_query(SE LECT guid FROM users WHERE id='$inviteid'" )
        > if (is_null($mrbgu id)){go into error page}[/color]

        Next time please post real code. That's where errors are 99% of the times.

        [color=blue]
        > All of my SQL knowledge tells me that this code should pull the GUID
        > field form the Users table based on the ID.[/color]

        It's normally better to just try the actual SQL code: open your favourite
        MySQL client and paste it there.



        --
        -+ Álvaro G. Vicario - Burgos, Spain
        ++ http://bits.demogracia.com es mi sitio para programadores web
        +- http://www.demogracia.com es mi web de humor libre de cloro
        --

        Comment

        Working...