[PHP] resource ID?

2001-06-21 Thread Kurth Bemis

i get this:

Resource id #2

when i run this code.whats resource id 2 mean?  i just want to know if 
the query was ok or not

$result = mysql_query("SELECT authcode FROM users WHERE email='$email'",$db);
echo $result;

~kurth


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] resource ID?

2001-06-21 Thread Kurth Bemis

i get this:

Resource id #2

when i run this code.whats resource id 2 mean?  i just want to know if 
the query was ok or not

$result = mysql_query("SELECT authcode FROM users WHERE email='$email'",$db);
echo $result;

~kurth 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource ID?

2001-06-21 Thread lenar

heh, that basically means that query was ok at least techincally.
When you echo that $result and get nothing - then something went wrong.
The right way to check if query was ok is:

if(is_resource($result))
echo "Query OK";

or just:

if($result)
echo "Query OK";

lenar.

"Kurth Bemis" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i get this:
> 
> Resource id #2
> 
> when i run this code.whats resource id 2 mean?  i just want to know if 
> the query was ok or not
> 
> $result = mysql_query("SELECT authcode FROM users WHERE email='$email'",$db);
> echo $result;
> 
> ~kurth
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource ID?

2001-06-21 Thread stylewarrior

this is because mysql_query() returns a result identifier for select
statements NOT a string or whatever you expected...

if ($result) {
my query was syntactically ok, but I still don't know anything about the
result
}
else {
my query was semantically invalid.
}

have a look at mysql_result() and mysql_num_rows() to find out more about
the result ouf
your query...


-
andi




Kurth Bemis <[EMAIL PROTECTED]> schrieb in im Newsbeitrag:
[EMAIL PROTECTED]
> i get this:
>
> Resource id #2
>
> when i run this code.whats resource id 2 mean?  i just want to know if
> the query was ok or not
>
> $result = mysql_query("SELECT authcode FROM users WHERE
email='$email'",$db);
> echo $result;
>
> ~kurth
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource ID?

2001-06-22 Thread Henrik Hansen

Kurth Bemis <[EMAIL PROTECTED]> wrote:

 > i get this:
 > 
 > Resource id #2
 > 
 > when i run this code.whats resource id 2 mean?  i just want to
 > know if the query was ok or not
 > 
 >  $result = mysql_query("SELECT authcode FROM users WHERE email='$email'",$db);
 >  echo $result;

because $result is the result of a mysql query and you can not echo
this to get the values instead you for example have to use
mysql_fetch_array to get all the values from the $result.

php.net/mysql

-- 
Henrik Hansen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] resource id #2

2001-04-16 Thread Greg K

I am trying to run a query and in my log I am  getting a message the message
resource id #2.

$query=mysql_query("Select pass from members where uname='$username'");
$result = mysql_query($query)
or die("You are not authorized to be here.");


Can someone tell me what I am doing wrong and guide me in the right
direction



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource id #2

2001-04-16 Thread Morgan Curley

try
$query="Select pass from members where uname='$username'";
$result = mysql_query($query) or die("You are not authorized to be here.");

the mysql_query command is executing the statement

morgan


At 10:40 AM 4/16/2001, Greg K wrote:
>I am trying to run a query and in my log I am  getting a message the message
>resource id #2.
>
>$query=mysql_query("Select pass from members where uname='$username'");
>$result = mysql_query($query)
>or die("You are not authorized to be here.");
>
>
>Can someone tell me what I am doing wrong and guide me in the right
>direction
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP] resource id #2

2001-04-16 Thread Tobias Talltorp

> $query=mysql_query("Select pass from members where uname='$username'");
> $result = mysql_query($query)
> or die("You are not authorized to be here.");



What you are doing is checking if the query is valid. Your die() would print
only if you had a faulty query (try changing pass to pass2), but if the
username is wrong, it returns an empty set.
The mysql_query() returns the "resource id #2" that you can use with the
mysql_fetch_array, mysql_num_rows etc to get printable information.

// Tobias



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource id #2

2001-04-16 Thread Ulf Wendel



Greg K schrieb:
> I am trying to run a query and in my log I am  getting a message the message
> resource id #2.
> 
> $query=mysql_query("Select pass from members where uname='$username'");
> $result = mysql_query($query)
> or die("You are not authorized to be here.");
> 
> Can someone tell me what I am doing wrong and guide me in the right
> direction

Please check the docs http://www.php.net/manual/en/ref.mysql.php /
http://www.php.net/manual/en/function.mysql-fetch-row.php (don't forget
to read the user comments!) and the usual sites for tutorials e.g.
http://www.phpbuilder.com .

Ulf

-- 
Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt
http://www.ulf-wendel.de/projekte/menu/tutorial.php |
http://www.phpdoc.de

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] resource id #2

2001-04-16 Thread Tobias Talltorp

Sorry...
Read morgans topic aswell...
DidnĀ“t see the duplicate mysql_query(). :)

// Tobias

""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message
9betpl$nb0$[EMAIL PROTECTED]">news:9betpl$nb0$[EMAIL PROTECTED]...
> > $query=mysql_query("Select pass from members where uname='$username'");
> > $result = mysql_query($query)
> > or die("You are not authorized to be here.");
>
>  $query=mysql_query("Select pass from members where uname='$username'");
> $result = mysql_query($query);
>
> // If the number of rows is less than one (meaning zero) then die()
> if ($mysql_num_rows($result) < 1)) {
> die("You are not authorized to be here.");
> }
> ?>
>
> What you are doing is checking if the query is valid. Your die() would
print
> only if you had a faulty query (try changing pass to pass2), but if the
> username is wrong, it returns an empty set.
> The mysql_query() returns the "resource id #2" that you can use with the
> mysql_fetch_array, mysql_num_rows etc to get printable information.
>
> // Tobias
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]