connect to db with php?
| From: | David | Date: | Sat, 21 Jun 2003 14:45:12 +0000 |
| Subject: | connect to db with php? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28787@lists.php.net to get a copy of this message | ||
Warning - beginner :-) I'm new at Linux, php and mysql, so please go slowly.
I have a test database with a couple of tables, etc., that I can connect to
and run simple queries against, etc., all from the command line. I do most
things as root, probably because I didn't set it up right and haven't fixed
it.
I'm trying to put together a simple php script to connect to the database and
learn about both at the same time. At the moment I have something like this:
<?php
$conn =
mysql_connect("127.0.0.1","root","password","databasename");
if (!$conn) die ("Could not connect");
blah blah
?>
which gives this result:
Warning: Access denied for user: 'root@localhost.localdomain' (Using password:
YES) in /var/www/html/php/script1.php on line 9
(line 9 is the $conn line, above)
I've tried a few variations but I'm not sure where to go from here.
Can anyone help out?
thanks
David
--
The arm folds in at the elbow, not out