Hi all. I am completely new to PHP and MySQL and this forum, so I hope someone can help. I have just installed xampp (completely out of the box as it were) and am having problems with a simple script. The script is below
<?php
ini_set('display_errors', 1);
$connx = mysql_connect("localhost", "root");
if($connx)
{
echo ("connected to database");
}
else
{
die("DB connection failed: " . mysql_error());
}
?>
I have also created a DB called 'test' with a table called 'members' containing
(int)id=1,
(varchar)username="jpc",
(varchar)password="1234"
My question is how do I
(1) specify the database name so that the database test is chosen?
(2) specify the table members?
(3) cycle through records (I know SQL and a loop will be needed)
I am trying to create a login script that checks the DB and table and finds a match.
I tried to use connect statement out of various tutorial such as
$connx = mysql_connect("localhost", "jpc", "1234"); I can see the logic behind this statement but this give me the following error/warning when parsed
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'jpc'@'localhost' (using password: YES) in C:\xampp\htdocs\checklogin.php on line 13
DB connection failed: Access denied for user 'jpc'@'localhost' (using password: YES)
ANY and I mean ANY enlightenment you guys can give me would be great.
P.S. Do I need to change anything in xampp (I am using xampp 1.7.2 if this helps and I haven't messed around with anything it is just as installed)
Many thanks for your time and effort in advance
JPC