I have just deployed my database to a remote server but unfortunately I cannot seem to be able to insert new records. PLEASE NOTE, that this was not the case as I was able (and still are) to insert and Delete records on my local server (WAMP).
Each time I try inserting a new record entry, I get a `Could not Add New record. No database selected.** It is also worth noting that the table entries that I had made before exporting the sql file are still visible in the remote database tables.
I have checked through the database config file and made sure that the respective database is chosen. Please, kindly assist as i have tried all.
Here is the code that i am working with:
connect.php
<?php
$hostname_connect = "localhost";
$database_connect = "dan_license";
$username_connect = "dan";
$password_connect = "anfield";
$connect = mysql_pconnect($hostname_connect, $username_connect, $password_connect) or trigger_error(mysql_error(),E_USER_ERROR);
?>
license_processer.php
<?php require_once('Connections/connect.php'); ?>
<?php
$value1 = $_POST['license_type'];
$value2 = $_POST['license_date'];
$value3 = $_POST['license_expiry'];
$value4 = $_POST['license_cost'];
$result = mysql_query("INSERT INTO license (license_type, license_date, license_expiry, license_cost) VALUES ('$value1', '$value2', '$value3', '$value4')");
?>
<?php include('includes/form_body.php'); ?>
form_body.php
<?php
if(!$result){
die('Could not Add New record: ' . mysql_error());
}
else{
echo "<h2>Success. New Record added!</h2>"; mysql_close();
}
?>
None of the options listed have been successful so far.