Re: mysql_num_rows
| From: | phplists at woodenpickle dot com | Date: | Sat, 13 Apr 2002 17:41:30 +0000 |
| Subject: | Re: mysql_num_rows | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18477@lists.php.net to get a copy of this message | ||
I ran into the same problem on a script yesterday.. It turns out that one of
the vars in my mysql_connect() command wasn't assigned.. It gave me no
indication of this so I hadn't thought to look there.. I just happened to be
reading back through the whole page to see what I could find and noticed
that I hadn't set the var at the top..
Something else that I noticed in your code is that there doesn't seem to be
a mysql_select_db() call.. Unless that is somewhere else in the code and
just not shown here, you'll need it I believe..
Just a couple thoughts,
Bob Weaver
"Luke Kearney" <lukek@meibin.net> wrote in message
news:20020413085630.70429.qmail@pb1.pair.com...
> Hello All,
> I am struggling to understand why my query throws an error the code as
below
>
> $link = mysql_connect ( "db.localhost.org", $user , $pass );
> if ( ! $link )
> die ( "Couldn't Connect to Mysql Server" );
> print "Sucessfully connect to server <p>";
> $query = "select * from users "
> ."where screen_name='$screen_name' "
> ." and passwd=password('$passwd')";
> $result = mysql_query($query, $link);
> if (mysql_num_rows($result) >0 )
>
> When executed you get a little message back like this one
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/share/doc/apache/trial/authmain.php on line 20
>
> What does this generally mean as I have noted that others use this syntax
so
> what is my issue ?
>
> Any help or pointers to references would be most appreciated.
>
> Thanks
>
> Luke K
>
>