Solved! mysql_connect() - but mysql_result problem occurs
| From: | Rino Mardo | Date: | Tue, 12 Dec 2000 17:10:00 +0000 |
| Subject: | Solved! mysql_connect() - but mysql_result problem occurs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29908@lists.php.net to get a copy of this message | ||
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>
--
--------------------------------------------------------------------
Key fingerprint = 9DE1 5825 77B4 FF45 7485 D3EB DCCF DE48 09B6 4426
--------------------------------------------------------------------
"Who's watching the watchmen?"