By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Query Problem

P: n/a
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.
Thanks
-Dave

Jun 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 26 Jun 2006 12:31:59 -0700, da********@gmail.com wrote:
$mbrguid = (mysql_query(SELECT guid FROM users WHERE id='$inviteid'")
if (is_null($mrbguid)){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.


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

http://uk.php.net/mysql_query

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jun 26 '06 #2

P: n/a
Message-ID: <11**********************@i40g2000cwc.googlegroups .com> from
da********@gmail.com contained the following:
$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.

$result = mysql_query("SELECT guid FROM users WHERE id='$inviteid'");
$mbrguid=mysql_fetch_array($result);
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/
Jun 26 '06 #3

P: n/a
*** da********@gmail.com escribió/wrote (26 Jun 2006 12:31:59 -0700):
$mbrguid = (mysql_query(SELECT guid FROM users WHERE id='$inviteid'")
if (is_null($mrbguid)){go into error page}
Next time please post real code. That's where errors are 99% of the times.

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


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
--
Jun 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.