473,383 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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(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
3 1866
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
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
*** 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
3
by: Brian Oster | last post by:
After applying security patch MS03-031 (Sql server ver 8.00.818) a query that used to execute in under 2 seconds, now takes over 8 Minutes to complete. Any ideas on what the heck might be going...
1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
8
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
4
by: Konrad Hammerer | last post by:
Hi! I have the following problem: I have a query (a) using another query (b) to get the amount of records of this other query (b), means: select count(MNR) as Number from...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.