Re: Solved! mysql_connect() - but mysql_result problem occurs
| From: | Ignacio Vazquez-Abrams | Date: | Tue, 12 Dec 2000 17:31:39 +0000 |
| Subject: | Re: Solved! mysql_connect() - but mysql_result problem occurs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29909@lists.php.net to get a copy of this message | ||
On Tue, 12 Dec 2000, Rino Mardo wrote:
> hi. since i can't find any solution to my "mysql_connect()" problem
> using .deb packages, i reinstalled LAMP using sources. it solved my
> problem.
>
> now my script is running and able to connect to my test database but i'm
> getting an error like this:
>
> Warning: Supplied argument is not a valid MySQL result resource in
> test.php on line 15
> Warning: Supplied argument is not a valid MySQL result resource in
> test.php on line 19
>
> i checked the php manual and my syntax and as far as i know i'm
> returning an integer to "mysql_result()". what could i be missing here?
>
> attached is my "test.php":
>
> <html>
>
> <head></head>
>
> <body>
> <?
>
> $server = "localhost";
> $user = "test";
> $pass = "test";
> $db = "mydb";
> $conn = mysql_connect($server, $user, $pass);
> $query = "select count(*) from url_list";
> $result = mysql_db_query($db, $query, $conn);
> $counter = mysql_result($result, 0);
>
> echo "There are $counter records in the database";
>
> mysql_free_result($result);
>
> ?>
>
> </body>
> </html>
>
Quick question: Does the userid test have select rights on mydb?
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>