Hello, Im not sure if this is suppose to go in the Newbies section, as i am new to PHP, anyway....I have created a php page that is suppose to insert data into a database. I am only new to this so bare with me....
I created the database 'comp' in microsoft access, with only 1 table named 'entry'. There are then 4 entries into the table, they are: name, age email & answer. Anyway, here is my code for my php page...this is after i click submit in my previous page.
<HTML>
<HEAD><TITLE>Insert Data</TITLE></HEAD><BODY>
<?PHP
$connection=mysql_connect("HOST","USERNAME","PASSWORD") or die('Could not connect to the database server');
$db = mysql_select_db("comp", $connection) or die ("Unable to select database.");
$sql = "INSERT INTO entry (name,age,email,answer) VALUES ('$name','$age','$email','$answer')";
$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');
echo('Data inserted successfully.');
mysql_close($connection);
?>
</BODY>
</HTML>
The problem is that when i press submit it says <b> Unable to select database</b> It connects to the server alright, however it cannot find the database. If someone could please help me, it would be very much appreciated as i am kinda new to PHP. Thanks,
Trish:p