I have a problem connecting to a MySQL database, my knowledge of both PHP and Databases is very thin on the ground, I have set things up as simple as possible just so I can get my head aroud it, and have spoken to my host on a number of occasions without much help, to explain:
I have no Telnet Access to the MySQL Database server, I access it via a Control Panel.
I have named the database employees and it only holds 4 records (number 4 is me)
Control Panel Help Files say;
To access mySQL via your web pages, connect to the mySQL server using the following credentials.
Parameter Value
+++++++++ +++++
Username: The account's username
Password: The account's main password
Database: The account's username
Server: localhost
++++++++++++++++++++++++++++++++++++++++++
This is just a test account I have created, the details are here.
Username: nationwidetest
Password: simple
Here is the source code I am trying to connect to the database with, which is in my root folder.
<head>
<title>MySQL Database</title>
</head>
<body>
<?php
$db = mysql_connect ("localhost","root","nationwidetest","simple","nationwidetest");
mysql_select_db ("employees",$db);
$result = mysql_query("SELECT * FROM employees");
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>