Hi, Once I have successfully connected to the database, i have a line that must insert values.
mysqli_query($edb, "INSERT INTO elvis_table (name,email) VALUES ('$name','$email')" ) or die('Error querying database.');
It works fine on my computer ( xampp ), but once I upload it onto a server, it starts giving an error.
Yes, I have a database with a corresponding table and fields on a server, it connects to the database fine, but gives an error on this line...
Thanks!
if (isset($_POST['submit_to_db'])) {
$name = trim($_POST['namefield']);
$email = trim($_POST['emailfield']);
$edb = mysqli_connect('mysql3.XXX.com', 'DB_NAME', 'DB_PASSWORD') or die('Error connecting to MySQL server.');
#upto here connects OK.
mysqli_query($edb, "INSERT INTO elvis_table (name,email) VALUES ('$name','$email')" ) or die('Error: ' . mysql_error());
# and dies here.