Re: resource id #2
| From: | Tobias Talltorp | Date: | Mon, 16 Apr 2001 14:09:52 +0000 |
| Subject: | Re: resource id #2 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48750@lists.php.net to get a copy of this message | ||
Sorry...
Read morgans topic aswell...
Didn´t see the duplicate mysql_query(). :)
// Tobias
""Tobias Talltorp"" <tobias@talltorp.com> wrote in message
news:9betpl$nb0$1@toye.p.sourceforge.net...
> > $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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>