Query Problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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(SELECT guid FROM users WHERE id='$inviteid'")
if (is_null($mrbguid)){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.



Re: Query Problem

On 26 Jun 2006 12:31:59 -0700, daksport00@gmail.com wrote:

Quoted text here. Click to load it

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


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

Re: Query Problem

daksport00@gmail.com contained the following:

Quoted text here. Click to load it

$result = mysql_query("SELECT guid FROM users WHERE id='$inviteid'");
if (is_null($mrbguid['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/

Re: Query Problem

*** daksport00@gmail.com escribió/wrote (26 Jun 2006 12:31:59 -0700):
Quoted text here. Click to load it

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

Quoted text here. Click to load it

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

Site Timeline