VitoCorleone
Programmer
hello everyone,
I have a sime error but cant figure out the solution.The following PHP script inserts 2 values into mySQL database i created using the POST method.
<?php
global $staffno;
global $fname;
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$sConn = mysql_connect($dbServer, "", "")
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO staff, fname VALUES ";
$dbQuery .= "(0, '$staffno', '$fname')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo "<h1>Data Uploaded</h1>";
?>
Here is the error i am getting which can be found in the code if the connection is unsucessful.
Couldn't connect to database dreamhome
The database has been created and so too has the table so why does it not connect? i have not created a user name or password for the database or its tables.
I have a sime error but cant figure out the solution.The following PHP script inserts 2 values into mySQL database i created using the POST method.
<?php
global $staffno;
global $fname;
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$sConn = mysql_connect($dbServer, "", "")
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO staff, fname VALUES ";
$dbQuery .= "(0, '$staffno', '$fname')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo "<h1>Data Uploaded</h1>";
?>
Here is the error i am getting which can be found in the code if the connection is unsucessful.
Couldn't connect to database dreamhome
The database has been created and so too has the table so why does it not connect? i have not created a user name or password for the database or its tables.